Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import gradio as gr
|
3 |
import google.generativeai as genai
|
4 |
from dotenv import load_dotenv
|
@@ -27,7 +28,8 @@ def chat_stream(message, history):
|
|
27 |
|
28 |
# Devolver los fragmentos como un flujo
|
29 |
for chunk in response:
|
30 |
-
if chunk.text:
|
|
|
31 |
yield chunk.text
|
32 |
|
33 |
except Exception as e:
|
|
|
1 |
import os
|
2 |
+
import time
|
3 |
import gradio as gr
|
4 |
import google.generativeai as genai
|
5 |
from dotenv import load_dotenv
|
|
|
28 |
|
29 |
# Devolver los fragmentos como un flujo
|
30 |
for chunk in response:
|
31 |
+
if chunk.text:
|
32 |
+
time.sleep(0.05) # Añade un pequeño retraso de 50ms entre chunks
|
33 |
yield chunk.text
|
34 |
|
35 |
except Exception as e:
|