Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import pickle
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
# Load your model from the .pkl file
|
| 6 |
-
with open('
|
| 7 |
model = pickle.load(model_file)
|
| 8 |
|
| 9 |
# Define the prediction function
|
|
@@ -27,19 +27,19 @@ def predict_disease(age, gender, fever, cough, fatigue, difficulty_breathing, bl
|
|
| 27 |
prediction = model.predict(input_features)
|
| 28 |
return prediction[0] # Return the predicted disease
|
| 29 |
|
| 30 |
-
# Gradio interface
|
| 31 |
inputs = [
|
| 32 |
-
gr.
|
| 33 |
-
gr.
|
| 34 |
-
gr.
|
| 35 |
-
gr.
|
| 36 |
-
gr.
|
| 37 |
-
gr.
|
| 38 |
-
gr.
|
| 39 |
-
gr.
|
| 40 |
]
|
| 41 |
|
| 42 |
-
outputs = gr.
|
| 43 |
|
| 44 |
# Create and launch the app
|
| 45 |
app = gr.Interface(fn=predict_disease, inputs=inputs, outputs=outputs, title="Symptom to Disease Prediction")
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
# Load your model from the .pkl file
|
| 6 |
+
with open('model.pkl', 'rb') as model_file:
|
| 7 |
model = pickle.load(model_file)
|
| 8 |
|
| 9 |
# Define the prediction function
|
|
|
|
| 27 |
prediction = model.predict(input_features)
|
| 28 |
return prediction[0] # Return the predicted disease
|
| 29 |
|
| 30 |
+
# Gradio interface using new components
|
| 31 |
inputs = [
|
| 32 |
+
gr.Number(label="Age"),
|
| 33 |
+
gr.Radio(choices=["Male", "Female"], label="Gender"),
|
| 34 |
+
gr.Radio(choices=["Yes", "No"], label="Fever"),
|
| 35 |
+
gr.Radio(choices=["Yes", "No"], label="Cough"),
|
| 36 |
+
gr.Radio(choices=["Yes", "No"], label="Fatigue"),
|
| 37 |
+
gr.Radio(choices=["Yes", "No"], label="Difficulty Breathing"),
|
| 38 |
+
gr.Dropdown(choices=["Low", "Normal", "High"], label="Blood Pressure"),
|
| 39 |
+
gr.Dropdown(choices=["Low", "Normal", "High"], label="Cholesterol Level")
|
| 40 |
]
|
| 41 |
|
| 42 |
+
outputs = gr.Textbox(label="Predicted Disease")
|
| 43 |
|
| 44 |
# Create and launch the app
|
| 45 |
app = gr.Interface(fn=predict_disease, inputs=inputs, outputs=outputs, title="Symptom to Disease Prediction")
|