Spaces:
Sleeping
Sleeping
Why is it stopping?
Browse files
main.py
CHANGED
@@ -107,7 +107,14 @@ async def generate_topic(
|
|
107 |
)
|
108 |
except Exception as e:
|
109 |
logger.error(f"Error in generate_topic: {str(e)}")
|
110 |
-
raise HTTPException(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
return AudioResponse(audio_base64=audio_base64)
|
112 |
except Exception as e:
|
113 |
logger.error(f"Error in generate_audio: {str(e)}")
|
|
|
107 |
)
|
108 |
except Exception as e:
|
109 |
logger.error(f"Error in generate_topic: {str(e)}")
|
110 |
+
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="An unexpected error occurred")
|
111 |
+
|
112 |
+
|
113 |
+
@app.post("/audioverse", response_model=AudioResponse)
|
114 |
+
async def generate_audio(text: str):
|
115 |
+
try:
|
116 |
+
audio_bytes = app.state.audio_utils.speak(text)
|
117 |
+
audio_base64 = base64.b64encode(audio_bytes).decode("utf-8")
|
118 |
return AudioResponse(audio_base64=audio_base64)
|
119 |
except Exception as e:
|
120 |
logger.error(f"Error in generate_audio: {str(e)}")
|