Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,21 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load the
|
| 5 |
-
model = pipeline("
|
| 6 |
|
| 7 |
# Function to diagnose based on symptoms
|
| 8 |
def diagnose(symptoms):
|
| 9 |
prediction = model(symptoms)
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Triage function based on symptoms
|
| 13 |
def triage(symptoms):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load the ClinicalBERT model
|
| 5 |
+
model = pipeline("text-classification", model="emilyalsentzer/Bio_ClinicalBERT")
|
| 6 |
|
| 7 |
# Function to diagnose based on symptoms
|
| 8 |
def diagnose(symptoms):
|
| 9 |
prediction = model(symptoms)
|
| 10 |
+
LABEL_TO_DIAGNOSIS = {
|
| 11 |
+
"LABEL_0": "Common Cold",
|
| 12 |
+
"LABEL_1": "Flu",
|
| 13 |
+
"LABEL_2": "Migraine",
|
| 14 |
+
"LABEL_3": "Pneumonia",
|
| 15 |
+
}
|
| 16 |
+
label = prediction[0]['label']
|
| 17 |
+
diagnosis = LABEL_TO_DIAGNOSIS.get(label, "Diagnosis not found")
|
| 18 |
+
return f"Possible diagnosis: {diagnosis}"
|
| 19 |
|
| 20 |
# Triage function based on symptoms
|
| 21 |
def triage(symptoms):
|