Spaces:
Sleeping
Sleeping
Download app.py from Sandhya4t7/drugresponsepreduction: direct link, hf CLI and curl.
- Browser
- Download file 862 Bytes
-
https://huggingface.co/spaces/Sandhya4t7/drugresponsepreduction/resolve/main/app.py
- Command line
-
hf download hf://spaces/Sandhya4t7/drugresponsepreduction/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Sandhya4t7/drugresponsepreduction/resolve/main/app.py
862 Bytes
| import gradio as gr | |
| import joblib | |
| import numpy as np | |
| # Load the trained model | |
| model = joblib.load("drug_model.pkl") | |
| # Prediction function | |
| def predict(age, gene1, gene2, gene3, dosage): | |
| input_data = np.array([[age, gene1, gene2, gene3, dosage]]) | |
| prediction = model.predict(input_data) | |
| return float(prediction[0]) | |
| # Gradio Interface | |
| interface = gr.Interface( | |
| fn=predict, | |
| inputs=[ | |
| gr.Number(label="Age"), | |
| gr.Number(label="Gene Marker 1"), | |
| gr.Number(label="Gene Marker 2"), | |
| gr.Number(label="Gene Marker 3"), | |
| gr.Number(label="Drug Dosage (mg)") | |
| ], | |
| outputs=gr.Number(label="Predicted Drug Effectiveness"), | |
| title="Drug Response Prediction App", | |
| description="Enter patient details and drug dosage to predict drug effectiveness." | |
| ) | |
| interface.launch(share=True) | |