Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -162,7 +162,6 @@ with gr.Blocks() as demo:
|
|
162 |
# start_time = time.time()
|
163 |
keep_streaming = True
|
164 |
for line in r.iter_lines():
|
165 |
-
time.sleep(0.001)
|
166 |
# if time.time() - start_time > MAX_SEC:
|
167 |
# keep_streaming = False
|
168 |
# break
|
@@ -231,6 +230,9 @@ with gr.Blocks() as demo:
|
|
231 |
if refusal_condition(history[-1][1]):
|
232 |
history[-1][1] = history[-1][1] + '\n\n**[免責聲明: Breeze-7B-Instruct 和 Breeze-7B-Instruct-64k 並未針對問答進行安全保護,因此語言模型的任何回應不代表 MediaTek Research 立場。]**'
|
233 |
yield history
|
|
|
|
|
|
|
234 |
|
235 |
print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
|
236 |
insert_to_db(message, response, float(temperature), float(top_p))
|
|
|
162 |
# start_time = time.time()
|
163 |
keep_streaming = True
|
164 |
for line in r.iter_lines():
|
|
|
165 |
# if time.time() - start_time > MAX_SEC:
|
166 |
# keep_streaming = False
|
167 |
# break
|
|
|
230 |
if refusal_condition(history[-1][1]):
|
231 |
history[-1][1] = history[-1][1] + '\n\n**[免責聲明: Breeze-7B-Instruct 和 Breeze-7B-Instruct-64k 並未針對問答進行安全保護,因此語言模型的任何回應不代表 MediaTek Research 立場。]**'
|
232 |
yield history
|
233 |
+
else:
|
234 |
+
del history[-1]
|
235 |
+
yield history
|
236 |
|
237 |
print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
|
238 |
insert_to_db(message, response, float(temperature), float(top_p))
|