Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,29 @@
|
|
| 1 |
-
from fastai.text.all import *
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
learn = load_learner('model.pkl')
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
description = "Medical Diagnosis"
|
| 9 |
-
categories = (['Allergy', 'Anemia', 'Bronchitis', 'Diabetes', 'Diarrhea', 'Fatigue', 'Flu', 'Malaria', 'Stress'])
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def classify_text(txt):
|
| 14 |
-
pred,idx,probs = learn.predict(txt)
|
| 15 |
-
return dict(zip(categories, map(float,probs)))
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
text = gr.
|
| 20 |
-
label = gr.
|
| 21 |
-
examples = ['I have no intrest in physical activity. i am always thirsty', 'I am freezing', 'My eyes are pale']
|
| 22 |
-
|
| 23 |
-
intf = gr.Interface(fn=classify_text, inputs=text, outputs=label, examples=examples, description=description)
|
| 24 |
-
intf.launch(inline=False)
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 1 |
+
from fastai.text.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
learn = load_learner('model.pkl')
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
description = "Medical Diagnosis"
|
| 9 |
+
categories = (['Allergy', 'Anemia', 'Bronchitis', 'Diabetes', 'Diarrhea', 'Fatigue', 'Flu', 'Malaria', 'Stress'])
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def classify_text(txt):
|
| 14 |
+
pred,idx,probs = learn.predict(txt)
|
| 15 |
+
return dict(zip(categories, map(float,probs)))
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
text = gr.Textbox(lines=2, label='Describe how you feel in great detail')
|
| 20 |
+
label = gr.Label()
|
| 21 |
+
examples = ['I have no intrest in physical activity. i am always thirsty', 'I am freezing', 'My eyes are pale']
|
| 22 |
+
|
| 23 |
+
intf = gr.Interface(fn=classify_text, inputs=text, outputs=label, examples=examples, description=description)
|
| 24 |
+
intf.launch(inline=False)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|