File size: 748 Bytes
5c8653f
5936730
 
 
5c8653f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from fastai.text.all import *
import gradio as gr


learn = load_learner('model.pkl')


description = "Medical Diagnosis"
categories = (['Allergy', 'Anemia', 'Bronchitis', 'Diabetes', 'Diarrhea', 'Fatigue', 'Flu', 'Malaria', 'Stress'])



def classify_text(txt):
    pred,idx,probs = learn.predict(txt)
    return dict(zip(categories, map(float,probs)))



text = gr.inputs.Textbox(lines=2, label='Describe how you feel in great detail')
label = gr.outputs.Label()
examples = ['I have no intrest in physical activity. i am always thirsty', 'I am freezing', 'My eyes are pale']

intf = gr.Interface(fn=classify_text, inputs=text, outputs=label, examples=examples, description=description)
intf.launch(inline=False)