He Bo
commited on
Commit
•
4503d3c
1
Parent(s):
ccd8ece
update
Browse files
app.py
CHANGED
@@ -62,7 +62,7 @@ Please automatically generate as many questions as possible based on this manual
|
|
62 |
"""
|
63 |
|
64 |
|
65 |
-
def get_answer(question,session_id,language,prompt,search_engine,index,top_k,score_type_checklist):
|
66 |
|
67 |
question=question.replace('AWS','亚马逊云科技').replace('aws','亚马逊云科技').replace('Aws','亚马逊云科技')
|
68 |
print('question:',question)
|
@@ -72,12 +72,11 @@ def get_answer(question,session_id,language,prompt,search_engine,index,top_k,sco
|
|
72 |
else:
|
73 |
url = api + "hello"
|
74 |
|
75 |
-
#
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
task = 'qa'
|
81 |
url += ('&task='+task)
|
82 |
|
83 |
if language == "english":
|
@@ -233,6 +232,7 @@ with demo:
|
|
233 |
|
234 |
with gr.Row():
|
235 |
with gr.Column():
|
|
|
236 |
query_textbox = gr.Textbox(label="Query")
|
237 |
session_id_textbox = gr.Textbox(label="Session ID")
|
238 |
qa_button = gr.Button("Summit")
|
@@ -266,7 +266,7 @@ with demo:
|
|
266 |
text_output = gr.Textbox()
|
267 |
|
268 |
|
269 |
-
qa_button.click(get_answer, inputs=[query_textbox,session_id_textbox,qa_language_radio,qa_prompt_textbox,qa_search_engine_radio,qa_index_textbox,qa_top_k_slider,score_type_checklist], outputs=qa_output)
|
270 |
summarize_button.click(get_summarize, inputs=[text_input,sm_language_radio,sm_prompt_textbox], outputs=text_output)
|
271 |
|
272 |
demo.launch()
|
|
|
62 |
"""
|
63 |
|
64 |
|
65 |
+
def get_answer(task_type,question,session_id,language,prompt,search_engine,index,top_k,score_type_checklist):
|
66 |
|
67 |
question=question.replace('AWS','亚马逊云科技').replace('aws','亚马逊云科技').replace('Aws','亚马逊云科技')
|
68 |
print('question:',question)
|
|
|
72 |
else:
|
73 |
url = api + "hello"
|
74 |
|
75 |
+
#task type: qa,chat
|
76 |
+
if task_type == "Knowledge base Q&A":
|
77 |
+
task = 'qa'
|
78 |
+
else:
|
79 |
+
task = 'chat'
|
|
|
80 |
url += ('&task='+task)
|
81 |
|
82 |
if language == "english":
|
|
|
232 |
|
233 |
with gr.Row():
|
234 |
with gr.Column():
|
235 |
+
qa_task_radio = gr.Radio(["Knowledge base Q&A","Chat"],value="Knowledge base Q&A",label="Task")
|
236 |
query_textbox = gr.Textbox(label="Query")
|
237 |
session_id_textbox = gr.Textbox(label="Session ID")
|
238 |
qa_button = gr.Button("Summit")
|
|
|
266 |
text_output = gr.Textbox()
|
267 |
|
268 |
|
269 |
+
qa_button.click(get_answer, inputs=[qa_task_radio,query_textbox,session_id_textbox,qa_language_radio,qa_prompt_textbox,qa_search_engine_radio,qa_index_textbox,qa_top_k_slider,score_type_checklist], outputs=qa_output)
|
270 |
summarize_button.click(get_summarize, inputs=[text_input,sm_language_radio,sm_prompt_textbox], outputs=text_output)
|
271 |
|
272 |
demo.launch()
|