Spaces:
Runtime error
Runtime error
Kannan Priyadharshan commited on
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -186,8 +186,9 @@ def welcome_stream(req: StreamReq):
|
|
| 186 |
answer = output.get("answer", "I couldn't generate a response.")
|
| 187 |
return StreamingResponse(stream_response(answer), media_type="text/plain")
|
| 188 |
except Exception as e:
|
|
|
|
| 189 |
def error_stream():
|
| 190 |
-
yield f"Error: {
|
| 191 |
return StreamingResponse(error_stream(), media_type="text/plain")
|
| 192 |
|
| 193 |
@app.post("/agents/skillnav/stream")
|
|
@@ -264,8 +265,9 @@ def skillnav_stream(req: StreamReq):
|
|
| 264 |
|
| 265 |
return StreamingResponse(plan_stream(), media_type="text/plain")
|
| 266 |
except Exception as e:
|
|
|
|
| 267 |
def error_stream():
|
| 268 |
-
yield f"Error generating learning plan: {
|
| 269 |
yield "Please try rephrasing your question or try again later."
|
| 270 |
return StreamingResponse(error_stream(), media_type="text/plain")
|
| 271 |
|
|
@@ -298,6 +300,7 @@ def progress_stream(req: StreamReq):
|
|
| 298 |
|
| 299 |
return StreamingResponse(stream_response(response_text), media_type="text/plain")
|
| 300 |
except Exception as e:
|
|
|
|
| 301 |
def error_stream():
|
| 302 |
-
yield f"Error: {
|
| 303 |
return StreamingResponse(error_stream(), media_type="text/plain")
|
|
|
|
| 186 |
answer = output.get("answer", "I couldn't generate a response.")
|
| 187 |
return StreamingResponse(stream_response(answer), media_type="text/plain")
|
| 188 |
except Exception as e:
|
| 189 |
+
error_msg = str(e) # Capture the error message
|
| 190 |
def error_stream():
|
| 191 |
+
yield f"Error: {error_msg}"
|
| 192 |
return StreamingResponse(error_stream(), media_type="text/plain")
|
| 193 |
|
| 194 |
@app.post("/agents/skillnav/stream")
|
|
|
|
| 265 |
|
| 266 |
return StreamingResponse(plan_stream(), media_type="text/plain")
|
| 267 |
except Exception as e:
|
| 268 |
+
error_msg = str(e) # Capture the error message
|
| 269 |
def error_stream():
|
| 270 |
+
yield f"Error generating learning plan: {error_msg}\n"
|
| 271 |
yield "Please try rephrasing your question or try again later."
|
| 272 |
return StreamingResponse(error_stream(), media_type="text/plain")
|
| 273 |
|
|
|
|
| 300 |
|
| 301 |
return StreamingResponse(stream_response(response_text), media_type="text/plain")
|
| 302 |
except Exception as e:
|
| 303 |
+
error_msg = str(e) # Capture the error message
|
| 304 |
def error_stream():
|
| 305 |
+
yield f"Error: {error_msg}"
|
| 306 |
return StreamingResponse(error_stream(), media_type="text/plain")
|