cotxetj commited on
Commit
ce545b4
1 Parent(s): 52cdceb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -152,8 +152,6 @@ def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature
152
  # decode each line as response data is in bytes
153
  if len(chunk) > 12 and "content" in json.loads(chunk[6:])['choices'][0]['delta']:
154
  partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
155
- print(partial_words)
156
- print(response)
157
  if token_counter == 0:
158
  history.append(" " + partial_words)
159
  else:
@@ -161,7 +159,8 @@ def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature
161
  token_counter += 1
162
  except Exception as e:
163
  print (f'error found: {e}')
164
-
 
165
  return history[-1][-1]
166
 
167
 
@@ -178,7 +177,7 @@ def predict(transType, language, audio, audio_mic = None):
178
  if not audio and audio_mic:
179
  audio = audio_mic
180
  st = gr.State([])
181
- return gpt_predict("Tell me about the swedish king in 1995!?",st), None
182
  if transType == "Text":
183
  return translate(audio), None
184
  if transType == "GPT answer":
 
152
  # decode each line as response data is in bytes
153
  if len(chunk) > 12 and "content" in json.loads(chunk[6:])['choices'][0]['delta']:
154
  partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
 
 
155
  if token_counter == 0:
156
  history.append(" " + partial_words)
157
  else:
 
159
  token_counter += 1
160
  except Exception as e:
161
  print (f'error found: {e}')
162
+ print("hist=", history)
163
+ print("part", partial_words)
164
  return history[-1][-1]
165
 
166
 
 
177
  if not audio and audio_mic:
178
  audio = audio_mic
179
  st = gr.State([])
180
+ return gpt_predict("Hi chat!",st), None
181
  if transType == "Text":
182
  return translate(audio), None
183
  if transType == "GPT answer":