Bofandra commited on
Commit
447241c
1 Parent(s): 59a4694

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -112,7 +112,7 @@ def respond(message,
112
  print("An error occurred:", error)
113
  print("en_message exception occurred")
114
 
115
- #print(messages)
116
  print("added last question\n")
117
  print(time.time())
118
 
@@ -126,13 +126,14 @@ def respond(message,
126
  top_p=top_p,
127
  ):
128
  try:
129
- token = message.choices[0].delta.content
130
- response += token
131
- if(len(response)>0):
132
- translated = translator.translate(response, src='en', dest=message_language)
133
- if not (translated is None):
134
- translated_response = translated.text
135
- yield translated_response
 
136
  except Exception as error:
137
  print("An error occurred:", error)
138
  yield ""
 
112
  print("An error occurred:", error)
113
  print("en_message exception occurred")
114
 
115
+ print(messages)
116
  print("added last question\n")
117
  print(time.time())
118
 
 
126
  top_p=top_p,
127
  ):
128
  try:
129
+ if len(message.choices)>0:
130
+ token = message.choices[0].delta.content
131
+ response += token
132
+ if(len(response)>0):
133
+ translated = translator.translate(response, src='en', dest=message_language)
134
+ if not (translated is None):
135
+ translated_response = translated.text
136
+ yield translated_response
137
  except Exception as error:
138
  print("An error occurred:", error)
139
  yield ""