File size: 828 Bytes
7c2c7b3
 
 
 
 
 
 
4399cd2
0fad990
7c2c7b3
 
 
 
 
 
 
 
 
2f38204
7c2c7b3
679a329
7c2c7b3
 
 
b45d698
c8c0e7a
 
 
 
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 = "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)