Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,13 +68,18 @@ def stream_chat(message: str, history: list, temperature: float, context_window:
|
|
| 68 |
response = client.chat(
|
| 69 |
model="gemma2",
|
| 70 |
messages=conversation,
|
| 71 |
-
stream=True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
)
|
| 73 |
|
| 74 |
-
|
| 75 |
for chunk in response:
|
| 76 |
-
|
| 77 |
-
yield
|
| 78 |
|
| 79 |
|
| 80 |
|
|
|
|
| 68 |
response = client.chat(
|
| 69 |
model="gemma2",
|
| 70 |
messages=conversation,
|
| 71 |
+
stream=True,
|
| 72 |
+
temperature=temperature,
|
| 73 |
+
top_k=top_k,
|
| 74 |
+
top_p=top_p,
|
| 75 |
+
num_ctx=context_window,
|
| 76 |
+
repeat_penalty=penalty,
|
| 77 |
)
|
| 78 |
|
| 79 |
+
buffer = ""
|
| 80 |
for chunk in response:
|
| 81 |
+
buffer += chunk["message"]["content"]
|
| 82 |
+
yield buffer
|
| 83 |
|
| 84 |
|
| 85 |
|