Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,19 +30,7 @@ label_map = {
|
|
| 30 |
'label_40': 'Impetigo'
|
| 31 |
}
|
| 32 |
|
| 33 |
-
# Step 3: Define the
|
| 34 |
-
def analyze_symptoms(symptoms):
|
| 35 |
-
predictions = health_classifier(symptoms)
|
| 36 |
-
top_prediction = predictions[0]
|
| 37 |
-
|
| 38 |
-
# MODIFIED: Look up the generic label in our new dictionary
|
| 39 |
-
generic_label = top_prediction['label']
|
| 40 |
-
disease = label_map.get(generic_label, "Unknown Label") # .get() safely handles unknown labels
|
| 41 |
-
confidence_score = top_prediction['score']
|
| 42 |
-
|
| 43 |
-
return f"Predicted Condition: {disease}\nConfidence: {confidence_score:.2f}"
|
| 44 |
-
|
| 45 |
-
# Step 4: Define the content for our app (No changes here)
|
| 46 |
app_title = "Symptom to Disease Classifier"
|
| 47 |
app_description = """
|
| 48 |
Enter a list of symptoms, and this AI will predict a possible related medical condition.
|
|
@@ -55,7 +43,7 @@ This is NOT a medical diagnostic tool. The predictions are generated by an AI mo
|
|
| 55 |
This tool should not be used for any real-world medical decision-making.
|
| 56 |
"""
|
| 57 |
|
| 58 |
-
# Step
|
| 59 |
app = gr.Interface(
|
| 60 |
fn=analyze_symptoms,
|
| 61 |
inputs=gr.Textbox(
|
|
|
|
| 30 |
'label_40': 'Impetigo'
|
| 31 |
}
|
| 32 |
|
| 33 |
+
# Step 3: Define the content for our app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
app_title = "Symptom to Disease Classifier"
|
| 35 |
app_description = """
|
| 36 |
Enter a list of symptoms, and this AI will predict a possible related medical condition.
|
|
|
|
| 43 |
This tool should not be used for any real-world medical decision-making.
|
| 44 |
"""
|
| 45 |
|
| 46 |
+
# Step 4: Create and Launch the Gradio Web App Interface
|
| 47 |
app = gr.Interface(
|
| 48 |
fn=analyze_symptoms,
|
| 49 |
inputs=gr.Textbox(
|