Spaces:
Runtime error
Runtime error
update chunk decode logic for byte literal
Browse files
app.py
CHANGED
@@ -67,12 +67,13 @@ def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[]
|
|
67 |
|
68 |
counter=0
|
69 |
for chunk in response.iter_lines():
|
|
|
70 |
if counter == 0:
|
71 |
counter+=1
|
72 |
continue
|
73 |
-
counter+=1
|
74 |
# check whether each line is non-empty
|
75 |
-
if chunk :
|
76 |
chunk = chunk.decode()
|
77 |
# decode each line as response data is in bytes
|
78 |
if len(chunk) > 6 and "delta" in json.loads(chunk[6:])['choices'][0]:
|
|
|
67 |
|
68 |
counter=0
|
69 |
for chunk in response.iter_lines():
|
70 |
+
#Skipping first chunk
|
71 |
if counter == 0:
|
72 |
counter+=1
|
73 |
continue
|
74 |
+
#counter+=1
|
75 |
# check whether each line is non-empty
|
76 |
+
if chunk.decode() :
|
77 |
chunk = chunk.decode()
|
78 |
# decode each line as response data is in bytes
|
79 |
if len(chunk) > 6 and "delta" in json.loads(chunk[6:])['choices'][0]:
|