Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,10 +128,7 @@ def stream_chat(message: str, history: list, model: str, temperature: float, max
|
|
| 128 |
},
|
| 129 |
)
|
| 130 |
|
| 131 |
-
|
| 132 |
-
for chunk in response:
|
| 133 |
-
buffer += chunk["message"]["content"]
|
| 134 |
-
yield buffer
|
| 135 |
|
| 136 |
|
| 137 |
|
|
@@ -145,7 +142,7 @@ def main(message: str, history: list, model: str, temperature: float, max_new_to
|
|
| 145 |
else:
|
| 146 |
if not process:
|
| 147 |
launch()
|
| 148 |
-
stream_chat(
|
| 149 |
message,
|
| 150 |
history,
|
| 151 |
model,
|
|
@@ -155,6 +152,11 @@ def main(message: str, history: list, model: str, temperature: float, max_new_to
|
|
| 155 |
top_k,
|
| 156 |
penalty
|
| 157 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
|
| 160 |
chatbot = gr.Chatbot(height=600, placeholder=DESCRIPTION)
|
|
|
|
| 128 |
},
|
| 129 |
)
|
| 130 |
|
| 131 |
+
return response
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
|
|
|
|
| 142 |
else:
|
| 143 |
if not process:
|
| 144 |
launch()
|
| 145 |
+
response = stream_chat(
|
| 146 |
message,
|
| 147 |
history,
|
| 148 |
model,
|
|
|
|
| 152 |
top_k,
|
| 153 |
penalty
|
| 154 |
)
|
| 155 |
+
|
| 156 |
+
buffer = ""
|
| 157 |
+
for chunk in response:
|
| 158 |
+
buffer += chunk["message"]["content"]
|
| 159 |
+
yield buffer
|
| 160 |
|
| 161 |
|
| 162 |
chatbot = gr.Chatbot(height=600, placeholder=DESCRIPTION)
|