Bofandra commited on
Commit
0fa7c3e
·
verified ·
1 Parent(s): 836ac40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -107,12 +107,15 @@ def respond(
107
  temperature=temperature,
108
  top_p=top_p,
109
  ):
110
- print(message.choices)
111
- token = message.choices[0].delta.content
112
- response += token
113
- print(response)
114
- translated_response = translator.translate(response, src='en', dest=message_language).text
115
- yield translated_response
 
 
 
116
 
117
  """
118
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
107
  temperature=temperature,
108
  top_p=top_p,
109
  ):
110
+ try:
111
+ print(message.choices)
112
+ token = message.choices[0].delta.content
113
+ response += token
114
+ print(response)
115
+ translated_response = translator.translate(response, src='en', dest=message_language).text
116
+ yield translated_response
117
+ except:
118
+ yield ""
119
 
120
  """
121
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface