Spaces:
No application file
No application file
Upload 2 files
Browse files- python.py +23 -0
- requirement.txt +8 -0
python.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!pip install -q gradio joblib
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import joblib
|
| 5 |
+
|
| 6 |
+
# Load model
|
| 7 |
+
model = joblib.load("dbs.jl")
|
| 8 |
+
|
| 9 |
+
# Prediction function
|
| 10 |
+
def predict_dbs(x):
|
| 11 |
+
pred = model.predict([[x]])
|
| 12 |
+
pred = pred[0][0]
|
| 13 |
+
return pred # extract single value
|
| 14 |
+
|
| 15 |
+
# Gradio interface
|
| 16 |
+
demo = gr.Interface(
|
| 17 |
+
fn=predict_dbs,
|
| 18 |
+
inputs=gr.Number(label="Input value"),
|
| 19 |
+
outputs=gr.Number(label="Prediction"),
|
| 20 |
+
title="DBS Prediction App"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
demo.launch()
|
requirement.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
groq
|
| 3 |
+
gunicorn
|
| 4 |
+
flask
|
| 5 |
+
pytz
|
| 6 |
+
pysqlite3
|
| 7 |
+
scikit-learn
|
| 8 |
+
joblib
|