from fastai.text.all import * import gradio as gr learn = load_learner('model.pkl') description = "GPTers_MedMax(메드맥스)_v1.2" categories = (['알러지', '빈혈', '기관지염', '당뇨', '장염', '피로', '독감', '말라리아', '스트레스']) def classify_text(txt): pred,idx,probs = learn.predict(txt) return dict(zip(categories, map(float,probs))) text = gr.inputs.Textbox(lines=2, label='당신의 증상을 "영어로" 작성해 주세요') label = gr.outputs.Label() examples = ['I am always thirsty and less activity', 'I have fever and cough', 'My face is so pale', 'I have skin rashes after eating crabs', 'I can not sleep well in the night'] intf = gr.Interface(fn=classify_text, inputs=text, outputs=label, examples=examples, description=description) intf.launch(inline=False)