Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,24 +19,18 @@ def generate_text(input_text, history):
|
|
| 19 |
response = output['choices'][0]['text']
|
| 20 |
history.append([input_text, response])
|
| 21 |
|
| 22 |
-
return "",
|
| 23 |
-
|
| 24 |
-
def bot(response):
|
| 25 |
-
history[-1][1] = ""
|
| 26 |
-
for character in response:
|
| 27 |
-
history[-1][1] += character
|
| 28 |
-
time.sleep(0.05)
|
| 29 |
-
yield history
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
msg.submit(generate_text, [msg, chatbot], [msg, chatbot]
|
| 37 |
|
| 38 |
-
demo.queue()
|
| 39 |
demo.launch()
|
| 40 |
|
| 41 |
|
| 42 |
|
|
|
|
|
|
| 19 |
response = output['choices'][0]['text']
|
| 20 |
history.append([input_text, response])
|
| 21 |
|
| 22 |
+
return "", history
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
with gr.Blocks() as demo:
|
| 25 |
+
chatbot = gr.Chatbot()
|
| 26 |
+
msg = gr.Textbox()
|
| 27 |
+
clear = gr.ClearButton([msg, chatbot])
|
| 28 |
|
| 29 |
+
msg.submit(generate_text, [msg, chatbot], [msg, chatbot])
|
| 30 |
|
| 31 |
+
demo.queue(concurrency_count=1, max_size=5)
|
| 32 |
demo.launch()
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
+
|