File size: 577 Bytes
ad16774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from predictOnce import Estimator


def predict(inputText):
    global e
    res = e.predict(inputText)
    return res[0], res[1]


if __name__ == '__main__':
    e = Estimator()
    iface = gr.Interface(fn=e.predict, inputs=gr.inputs.Textbox(lines=2, label="输入语句", placeholder="输入要识别的语句..."),
                         outputs=[gr.outputs.Textbox(label="意图"), gr.outputs.Textbox(label="槽值")], live=True,
                         theme="huggingface", allow_screenshot=False, allow_flagging=False)
    iface.launch(share=True)