Spaces:
No application file
No application file
Create app.py
#1
by
Thiwanka01
- opened
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import joblib # Replace with your model loading library
|
3 |
+
|
4 |
+
# Load pre-trained model
|
5 |
+
model = joblib.load("diagnostic_model.pkl")
|
6 |
+
|
7 |
+
# Define the prediction function
|
8 |
+
def predict_disease(symptoms):
|
9 |
+
prediction = model.predict([symptoms])[0]
|
10 |
+
return f"Predicted Diagnosis: {prediction}"
|
11 |
+
|
12 |
+
# Create the Gradio interface
|
13 |
+
interface = gr.Interface(
|
14 |
+
fn=predict_disease,
|
15 |
+
inputs=gr.inputs.Textbox(lines=5, placeholder="Enter symptoms..."),
|
16 |
+
outputs=gr.outputs.Textbox(label="Diagnosis")
|
17 |
+
)
|
18 |
+
|
19 |
+
# Launch the interface
|
20 |
+
interface.launch()
|