Spaces:
Runtime error
Runtime error
update streaming code for using chunks
Browse files
app.py
CHANGED
|
@@ -79,7 +79,7 @@ def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[]
|
|
| 79 |
if len(chunk) > 12 and "delta" in json.loads(chunk[6:])['choices'][0]:
|
| 80 |
#if len(json.loads(chunk.decode()[6:])['choices'][0]["delta"]) == 0:
|
| 81 |
# break
|
| 82 |
-
partial_words = partial_words + json.loads(chunk
|
| 83 |
if token_counter == 0:
|
| 84 |
history.append(" " + partial_words)
|
| 85 |
else:
|
|
|
|
| 79 |
if len(chunk) > 12 and "delta" in json.loads(chunk[6:])['choices'][0]:
|
| 80 |
#if len(json.loads(chunk.decode()[6:])['choices'][0]["delta"]) == 0:
|
| 81 |
# break
|
| 82 |
+
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
| 83 |
if token_counter == 0:
|
| 84 |
history.append(" " + partial_words)
|
| 85 |
else:
|