SENN bandgap predictor for perovskite compositions
Project description
SENN Bandgap Predictor
This repository packages a SENN perovskite bandgap model as:
- a Python package,
- a command-line tool,
- a FastAPI HTTP API,
- a Streamlit web app.
Input convention
The model input order is:
[MA, FA, Cs, Br, Cl, I]
Internally:
site_a = [MA, FA, Cs]site_x = [Br, Cl, I]
Local installation
cd senn_bandgap_deploy_template
pip install -e .
Python usage
from senn_bandgap import BandgapPredictor
predictor = BandgapPredictor()
y = predictor.predict([[0.0, 1.0, 0.0, 0.0, 0.0, 1.0]])
print(y[0])
CLI usage
senn-bandgap --MA 0 --FA 1 --Cs 0 --Br 0 --Cl 0 --I 1
Start FastAPI server
uvicorn api_fastapi:app --host 0.0.0.0 --port 8000
Open:
http://127.0.0.1:8000/docs
Example request:
curl -X POST "http://127.0.0.1:8000/predict" -H "Content-Type: application/json" -d '{"MA":0,"FA":1,"Cs":0,"Br":0,"Cl":0,"I":1}'
Start Streamlit app
streamlit run app_streamlit.py
Deployment options
Streamlit Community Cloud
Push this repository to GitHub, then select app_streamlit.py as the entrypoint.
Hugging Face Spaces
Create a Space and use Gradio or Streamlit as the SDK. For Streamlit, keep app_streamlit.py and requirements.txt.
Docker + FastAPI
docker build -t senn-bandgap .
docker run -p 8000:8000 senn-bandgap
Important note
If the original training used input normalization, target scaling, or composition preprocessing, you must reproduce exactly the same preprocessing during inference. Otherwise the API will run, but the predicted bandgap values may be numerically inconsistent with training.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file senn_bandgap-0.1.0.tar.gz.
File metadata
- Download URL: senn_bandgap-0.1.0.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9981ebe79831515ec6bd2a91a59a78e1597859f81a65a0bda84ff262b35cf3ab
|
|
| MD5 |
96e4709d66e55c317bd1390a20edfbe7
|
|
| BLAKE2b-256 |
eb7b1dcddb292e1a08529160783ffa03b7ee8754d4f49c7c96d9d17a15ea0e0f
|
File details
Details for the file senn_bandgap-0.1.0-py3-none-any.whl.
File metadata
- Download URL: senn_bandgap-0.1.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb39f780e59daa55da3a5ff640411cea76107826bedc7d85a16bf765cd266a3
|
|
| MD5 |
203c12e53a83a22c7c4d687fb9a19b8a
|
|
| BLAKE2b-256 |
6ee18222568dffe5d9b0ed30f97cfae7adb8a36f6ea73af92427b548a37d3020
|