Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -152,8 +152,13 @@ def generate(
|
|
| 152 |
)
|
| 153 |
|
| 154 |
formatted_prompt = format_prompt(f"{system_prompt}\n\n{prompt}", history)
|
| 155 |
-
|
| 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):
|