Spaces:
Build error
Build error
zhijiang
commited on
Commit
•
89621bb
1
Parent(s):
2591fef
fix examples bug of missing radio value
Browse files
app.py
CHANGED
@@ -12,18 +12,21 @@ def qa_fn(ask,ctxt,model):
|
|
12 |
#注意HighlightedText的用法。有两种不同用法:https://gradio.app/named_entity_recognition/
|
13 |
# 一种是list of dict ,一种是list of tuple. 详细用法参考https://gradio.app/named_entity_recognition/吧
|
14 |
|
15 |
-
samples= [
|
|
|
|
|
|
|
16 |
introStr = "用于演示使用人工智能自动寻找问题答案,这将是一种更加高效便捷的新型信息检索方式。";
|
17 |
-
titleStr ="智能问答演示程序";
|
18 |
|
19 |
demo = gr.Interface(qa_fn,
|
20 |
inputs=[gr.Textbox(label="Question",placeholder='请输入问题'),
|
21 |
-
gr.Textbox(label="
|
22 |
-
gr.Radio(["deepset","
|
23 |
],
|
24 |
outputs=[gr.HighlightedText(label='答案位置'),gr.Textbox(label="答案"),gr.Number(label="Score")],
|
25 |
examples=samples,
|
26 |
description=introStr,
|
27 |
title=titleStr);
|
28 |
|
29 |
-
demo.launch()
|
|
|
12 |
#注意HighlightedText的用法。有两种不同用法:https://gradio.app/named_entity_recognition/
|
13 |
# 一种是list of dict ,一种是list of tuple. 详细用法参考https://gradio.app/named_entity_recognition/吧
|
14 |
|
15 |
+
samples= [
|
16 |
+
["乔治的哥哥叫什么名字?","我是小猪佩奇,我是乔治的哥哥,我家住在北京","deepset"],
|
17 |
+
["图书馆主页的网址是多少啊?","读者进入图书馆主页(http://lib.tjut.edu.cn)后,点击文献传递菜单,即可查看文献传递的具体流程步骤","mrc"],
|
18 |
+
];
|
19 |
introStr = "用于演示使用人工智能自动寻找问题答案,这将是一种更加高效便捷的新型信息检索方式。";
|
20 |
+
titleStr = "智能问答演示程序";
|
21 |
|
22 |
demo = gr.Interface(qa_fn,
|
23 |
inputs=[gr.Textbox(label="Question",placeholder='请输入问题'),
|
24 |
+
gr.Textbox(label="Contexkht",lines=10,placeholder="请输入一段文本"),
|
25 |
+
gr.Radio(["deepset","mrc"],label="Select Model", value="deepset"),
|
26 |
],
|
27 |
outputs=[gr.HighlightedText(label='答案位置'),gr.Textbox(label="答案"),gr.Number(label="Score")],
|
28 |
examples=samples,
|
29 |
description=introStr,
|
30 |
title=titleStr);
|
31 |
|
32 |
+
demo.launch()
|