Vinit710 commited on
Commit
9dec907
·
verified ·
1 Parent(s): fa72bf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
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('disease_prediction_model.pkl', 'rb') as model_file:
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.inputs.Number(label="Age"),
33
- gr.inputs.Radio(choices=["Male", "Female"], label="Gender"),
34
- gr.inputs.Radio(choices=["Yes", "No"], label="Fever"),
35
- gr.inputs.Radio(choices=["Yes", "No"], label="Cough"),
36
- gr.inputs.Radio(choices=["Yes", "No"], label="Fatigue"),
37
- gr.inputs.Radio(choices=["Yes", "No"], label="Difficulty Breathing"),
38
- gr.inputs.Dropdown(choices=["Low", "Normal", "High"], label="Blood Pressure"),
39
- gr.inputs.Dropdown(choices=["Low", "Normal", "High"], label="Cholesterol Level")
40
  ]
41
 
42
- outputs = gr.outputs.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")
 
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")