Spaces:
Configuration error
Configuration error
Janet Garcia
commited on
Commit
·
c32fbd8
0
Parent(s):
Initial commit: exoplanet
Browse files- .gitattributes +1 -0
- .gitignore +35 -0
- app.py +27 -0
- model.joblib +3 -0
- requirements.txt +5 -0
.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
model.joblib filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
*.so
|
| 4 |
+
|
| 5 |
+
# Virtual environments & local tooling
|
| 6 |
+
venv/
|
| 7 |
+
.venv/
|
| 8 |
+
env/
|
| 9 |
+
ENV/
|
| 10 |
+
.env
|
| 11 |
+
.env.*
|
| 12 |
+
pip-wheel-metadata/
|
| 13 |
+
|
| 14 |
+
# Build / packaging artifacts
|
| 15 |
+
*.egg-info/
|
| 16 |
+
dist/
|
| 17 |
+
build/
|
| 18 |
+
|
| 19 |
+
# Notebooks & test caches
|
| 20 |
+
.ipynb_checkpoints/
|
| 21 |
+
.pytest_cache/
|
| 22 |
+
.mypy_cache/
|
| 23 |
+
.ruff_cache/
|
| 24 |
+
|
| 25 |
+
# Coverage & log files
|
| 26 |
+
.coverage
|
| 27 |
+
coverage.xml
|
| 28 |
+
htmlcov/
|
| 29 |
+
*.log
|
| 30 |
+
|
| 31 |
+
# OS cruft
|
| 32 |
+
.DS_Store
|
| 33 |
+
|
| 34 |
+
# Hugging Face cache (set HF_HOME outside repo when possible)
|
| 35 |
+
.cache/huggingface/
|
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
FEATURES = ["koi_period", "koi_duration", "koi_prad", "koi_depth"]
|
| 6 |
+
model = joblib.load("model.joblib")
|
| 7 |
+
|
| 8 |
+
def predict(koi_period, koi_duration, koi_prad, koi_depth):
|
| 9 |
+
X = pd.DataFrame([[koi_period, koi_duration, koi_prad, koi_depth]], columns=FEATURES)
|
| 10 |
+
y = model.predict(X)[0]
|
| 11 |
+
try:
|
| 12 |
+
p = model.predict_proba(X)[0][1]
|
| 13 |
+
label = "Candidate exoplanet" if int(y) == 1 else "Likely false positive"
|
| 14 |
+
return f"{label} | probability: {p:.2f}"
|
| 15 |
+
except Exception:
|
| 16 |
+
return "Candidate exoplanet" if int(y) == 1 else "Likely false positive"
|
| 17 |
+
|
| 18 |
+
demo = gr.Interface(
|
| 19 |
+
fn=predict,
|
| 20 |
+
inputs=[gr.Number(label=f) for f in FEATURES],
|
| 21 |
+
outputs=gr.Textbox(label="Prediction"),
|
| 22 |
+
title="Exoplanet Transit Classifier",
|
| 23 |
+
description="Enter KOI features to get a quick classification."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
if __name__ == "__main__":
|
| 27 |
+
demo.launch()
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83b1213f83598de11a3bb3c12d208bebf3a170be192e90c66fa772af528afb4c
|
| 3 |
+
size 31447209
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
scikit-learn
|
| 3 |
+
joblib
|
| 4 |
+
numpy
|
| 5 |
+
pandas
|