Spaces:
Runtime error
Runtime error
update chunk logic
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ def predict_chatgpt(inputs, top_p_chatgpt, temperature_chatgpt, openai_api_key,
|
|
80 |
print(json.loads(chunk[6:]))
|
81 |
print("*************************************")
|
82 |
# decode each line as response data is in bytes
|
83 |
-
if len(chunk) >
|
84 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
85 |
if token_counter == 0:
|
86 |
history.append(" " + partial_words)
|
|
|
80 |
print(json.loads(chunk[6:]))
|
81 |
print("*************************************")
|
82 |
# decode each line as response data is in bytes
|
83 |
+
if len(chunk) > 13 and "content" in json.loads(chunk[6:])['choices'][0]["delta"]:
|
84 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
85 |
if token_counter == 0:
|
86 |
history.append(" " + partial_words)
|