acecalisto3 commited on
Commit
bb836a6
1 Parent(s): 13c0605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -152,8 +152,13 @@ def generate(
152
  )
153
 
154
  formatted_prompt = format_prompt(f"{system_prompt}\n\n{prompt}", history)
155
- output = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, return_full_text=False)
156
-
 
 
 
 
 
157
  return output
158
 
159
  def update_sys_prompt(agent):
 
152
  )
153
 
154
  formatted_prompt = format_prompt(f"{system_prompt}\n\n{prompt}", history)
155
+
156
+ try:
157
+ output = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, return_full_text=False)
158
+ except Exception as e:
159
+ logger.error(f"Error during model inference: {e}")
160
+ return "Sorry, there was an error processing your request. Please try again later."
161
+
162
  return output
163
 
164
  def update_sys_prompt(agent):