He Bo
commited on
Commit
•
9c4d272
1
Parent(s):
08b679c
updata
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import json
|
|
3 |
import gradio as gr
|
4 |
from datetime import datetime
|
5 |
|
6 |
-
invoke_url = "https://
|
7 |
api = invoke_url + '/langchain_processor_qa?query='
|
8 |
|
9 |
# chinese_index = "smart_search_qa_test_0614_wuyue_2"
|
@@ -82,20 +82,15 @@ def get_answer(question,session_id,language,prompt,search_engine,index,top_k,tem
|
|
82 |
url += '&language=english'
|
83 |
url += ('&embedding_endpoint_name=pytorch-inference-all-minilm-l6-v2')
|
84 |
url += ('&llm_embedding_name=pytorch-inference-vicuna-p3-2x')
|
85 |
-
elif language == "chinese
|
86 |
url += '&language=chinese'
|
87 |
url += ('&embedding_endpoint_name=huggingface-inference-text2vec-base-chinese-v1')
|
88 |
-
url += ('&llm_embedding_name=pytorch-inference-
|
89 |
|
90 |
-
elif language == "chinese-
|
91 |
-
url += '&language=chinese'
|
92 |
url += ('&embedding_endpoint_name=huggingface-inference-text2vec-base-chinese-v1')
|
93 |
-
url += ('&llm_embedding_name=pytorch-inference-chatglm2-g5-2x')
|
94 |
-
|
95 |
-
# if llm_instance == 'p3-8x':
|
96 |
-
# url += ('&llm_embedding_name=pytorch-inference-chatglm-v1-p3-8x')
|
97 |
-
# elif llm_instance == 'g4dn-8x':
|
98 |
-
# url += ('&llm_embedding_name=pytorch-inference-chatglm-v1-8x')
|
99 |
|
100 |
if len(session_id) > 0:
|
101 |
url += ('&session_id='+session_id)
|
@@ -240,7 +235,7 @@ with demo:
|
|
240 |
session_id_textbox = gr.Textbox(label="Session ID")
|
241 |
qa_button = gr.Button("Summit")
|
242 |
|
243 |
-
qa_language_radio = gr.Radio(["chinese
|
244 |
# qa_llm_radio = gr.Radio(["p3-8x", "g4dn-8x"],value="p3-8x",label="Chinese llm instance")
|
245 |
qa_prompt_textbox = gr.Textbox(label="Prompt( must include {context} and {question} )",placeholder=chinese_prompt,lines=2)
|
246 |
qa_search_engine_radio = gr.Radio(["OpenSearch","Kendra"],value="OpenSearch",label="Search engine")
|
|
|
3 |
import gradio as gr
|
4 |
from datetime import datetime
|
5 |
|
6 |
+
invoke_url = "https://zhw65mrud3.execute-api.us-west-2.amazonaws.com/prod"
|
7 |
api = invoke_url + '/langchain_processor_qa?query='
|
8 |
|
9 |
# chinese_index = "smart_search_qa_test_0614_wuyue_2"
|
|
|
82 |
url += '&language=english'
|
83 |
url += ('&embedding_endpoint_name=pytorch-inference-all-minilm-l6-v2')
|
84 |
url += ('&llm_embedding_name=pytorch-inference-vicuna-p3-2x')
|
85 |
+
elif language == "chinese":
|
86 |
url += '&language=chinese'
|
87 |
url += ('&embedding_endpoint_name=huggingface-inference-text2vec-base-chinese-v1')
|
88 |
+
url += ('&llm_embedding_name=pytorch-inference-chatglm2-g5-2x')
|
89 |
|
90 |
+
elif language == "chinese-tc":
|
91 |
+
url += '&language=chinese-tc'
|
92 |
url += ('&embedding_endpoint_name=huggingface-inference-text2vec-base-chinese-v1')
|
93 |
+
url += ('&llm_embedding_name=pytorch-inference-chatglm2-g5-2x')
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
if len(session_id) > 0:
|
96 |
url += ('&session_id='+session_id)
|
|
|
235 |
session_id_textbox = gr.Textbox(label="Session ID")
|
236 |
qa_button = gr.Button("Summit")
|
237 |
|
238 |
+
qa_language_radio = gr.Radio(["chinese","chinese-tc", "english"],value="chinese",label="Language")
|
239 |
# qa_llm_radio = gr.Radio(["p3-8x", "g4dn-8x"],value="p3-8x",label="Chinese llm instance")
|
240 |
qa_prompt_textbox = gr.Textbox(label="Prompt( must include {context} and {question} )",placeholder=chinese_prompt,lines=2)
|
241 |
qa_search_engine_radio = gr.Radio(["OpenSearch","Kendra"],value="OpenSearch",label="Search engine")
|