Spaces:
Runtime error
Runtime error
Commit
·
089ac30
1
Parent(s):
675fa08
update timeout
Browse files
app.py
CHANGED
|
@@ -138,9 +138,14 @@ def stream(input_text) -> Generator:
|
|
| 138 |
content = ""
|
| 139 |
|
| 140 |
# Get each new token from the queue and yield for our generator
|
|
|
|
| 141 |
while True:
|
| 142 |
try:
|
| 143 |
-
next_token = q.get(True, timeout=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
if next_token is job_done:
|
| 145 |
break
|
| 146 |
content += next_token
|
|
@@ -2125,7 +2130,7 @@ with gr.Blocks() as demo:
|
|
| 2125 |
# inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button])
|
| 2126 |
''' open ai | new'''
|
| 2127 |
# chathmi4 = normal, chathmi5 = callback
|
| 2128 |
-
inf4 = inputtext.submit(
|
| 2129 |
success(playsound1, None, voice_output, queue=True)#.\
|
| 2130 |
# success(ClearAudio, None, voice_output)
|
| 2131 |
|
|
|
|
| 138 |
content = ""
|
| 139 |
|
| 140 |
# Get each new token from the queue and yield for our generator
|
| 141 |
+
counter = 0
|
| 142 |
while True:
|
| 143 |
try:
|
| 144 |
+
next_token = q.get(True, timeout=60)
|
| 145 |
+
counter = counter + 1
|
| 146 |
+
print("No data, retry number: ", counter)
|
| 147 |
+
if counter > 3:
|
| 148 |
+
break
|
| 149 |
if next_token is job_done:
|
| 150 |
break
|
| 151 |
content += next_token
|
|
|
|
| 2130 |
# inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button])
|
| 2131 |
''' open ai | new'''
|
| 2132 |
# chathmi4 = normal, chathmi5 = callback
|
| 2133 |
+
inf4 = inputtext.submit(chathmi5, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button]).\
|
| 2134 |
success(playsound1, None, voice_output, queue=True)#.\
|
| 2135 |
# success(ClearAudio, None, voice_output)
|
| 2136 |
|