sehatguard commited on
Commit
bc8c1a4
·
verified ·
1 Parent(s): dbbf677

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1,13 +1,21 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the pre-trained model (you can replace this with any healthcare model from Hugging Face)
5
- model = pipeline("fill-mask", model="medicalai/ClinicalBERT")
6
 
7
  # Function to diagnose based on symptoms
8
  def diagnose(symptoms):
9
  prediction = model(symptoms)
10
- return f"Possible diagnosis: {prediction[0]['label']}"
 
 
 
 
 
 
 
 
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):