ysharma HF staff commited on
Commit
b1a1d84
·
1 Parent(s): 0d47022

update chunk logic

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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) > 12 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)
 
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)