Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -1109,10 +1109,10 @@ def netOrNotnet(
|
|
1109 |
user_input, chatbot, max_length, top_p, temperature, history, past_key_values
|
1110 |
):
|
1111 |
user_input_original = user_input
|
1112 |
-
user_input_prompt = '请判断这个指令:“' + user_input + '”是否需要通过网络搜索才能准确完成,你只需要回答"是"或者"否"
|
1113 |
|
1114 |
response, history = model.chat(tokenizer, user_input_prompt,top_p=0.2, temperature=0.85, history=[])
|
1115 |
-
ytkeywords = ['
|
1116 |
|
1117 |
NET = any(keyword in response for keyword in ytkeywords)
|
1118 |
|
@@ -1120,7 +1120,8 @@ def netOrNotnet(
|
|
1120 |
print(response)
|
1121 |
print(NET)
|
1122 |
if NET:
|
1123 |
-
yield from
|
|
|
1124 |
user_input_original,
|
1125 |
chatbot,
|
1126 |
max_length,
|
@@ -1131,9 +1132,9 @@ def netOrNotnet(
|
|
1131 |
)
|
1132 |
|
1133 |
|
|
|
1134 |
else:
|
1135 |
-
yield from
|
1136 |
-
RETRY_FLAG,# type: ignore
|
1137 |
user_input_original,
|
1138 |
chatbot,
|
1139 |
max_length,
|
|
|
1109 |
user_input, chatbot, max_length, top_p, temperature, history, past_key_values
|
1110 |
):
|
1111 |
user_input_original = user_input
|
1112 |
+
user_input_prompt = '请判断这个指令:“' + user_input + '”是否需要通过网络搜索才能准确完成,你只需要回答"是"或者"否",不要其它多余的内容'
|
1113 |
|
1114 |
response, history = model.chat(tokenizer, user_input_prompt,top_p=0.2, temperature=0.85, history=[])
|
1115 |
+
ytkeywords = ['否。', '不需要通过网络']
|
1116 |
|
1117 |
NET = any(keyword in response for keyword in ytkeywords)
|
1118 |
|
|
|
1120 |
print(response)
|
1121 |
print(NET)
|
1122 |
if NET:
|
1123 |
+
yield from predict(
|
1124 |
+
RETRY_FLAG,# type: ignore
|
1125 |
user_input_original,
|
1126 |
chatbot,
|
1127 |
max_length,
|
|
|
1132 |
)
|
1133 |
|
1134 |
|
1135 |
+
|
1136 |
else:
|
1137 |
+
yield from GGSearch(
|
|
|
1138 |
user_input_original,
|
1139 |
chatbot,
|
1140 |
max_length,
|