dreamboat26's picture
Update app.py
566f247 verified
raw
history blame
601 Bytes
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.Textbox(lines=2, label='List out your symptoms to get the possible cause of your symptoms')
label = gr.Label()
intf = gr.Interface(fn=classify_text, inputs=text, outputs=label, description=description)
intf.launch(inline=False)