sunil18p31a0101 commited on
Commit
ccc2bbb
·
verified ·
1 Parent(s): 6f3e953

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -125,3 +125,25 @@ def predict_hemoglobin(age, gender, image):
125
  except Exception as e:
126
  print(f"An error occurred during prediction: {e}")
127
  return "An error occurred during prediction. Please try again."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  except Exception as e:
126
  print(f"An error occurred during prediction: {e}")
127
  return "An error occurred during prediction. Please try again."
128
+ # Gradio interface
129
+ with gr.Blocks() as anemia_detection_app:
130
+ gr.Markdown("# Hemoglobin Prediction App")
131
+
132
+ with gr.Row():
133
+ age_input = gr.Number(label="Age", value=25)
134
+ gender_input = gr.Radio(label="Gender", choices=["Male", "Female"], value="Male")
135
+
136
+ image_input = gr.Image(label="Upload Retinal Image", type="pil")
137
+ output_text = gr.Textbox(label="Predicted Hemoglobin Value")
138
+
139
+ predict_button = gr.Button("Predict")
140
+
141
+ predict_button.click(
142
+ fn=predict_hemoglobin,
143
+ inputs=[age_input, gender_input, image_input],
144
+ outputs=output_text
145
+ )
146
+
147
+ # Run the app
148
+ if __name__ == "__main__":
149
+ anemia_detection_app.launch()