Spaces:
Runtime error
Runtime error
Saqib commited on
Update modules/app.py
Browse files132 unmodified lines133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163132 unmodified lines print(f"An error occurred: {str(e)}") print(traceback.format_exc()) raise HTTPException(status_code=500, detail=f"An unexpected error occurred: {str(e)}") @app.post("/concatenate_audio")async def concatenate_audio(request: Request): try: # Generate a unique filename for the output output_filename = f"{uuid.uuid4()}.mp3" output_path = os.path.join(AUDIO_DIR, output_filename)
# Call the modal API with the request data and download the output file data = await request.json() async with aiohttp.ClientSession() as session: async with session.post(f"{MODAL_BASE_URL}/concatenate_audio", json=data) as response: if response.status != 200: raise HTTPException(status_code=500, detail="Failed to process request") output_data = await response.read() async with aiofiles.open(output_path, "wb") as f: await f.write(output_data)
# Return the URL path to the output file return f"https://sxqib-api.hf.space/audio_files/{output_filename}"
except Exception as e: print(f"An error occurred: {str(e)}") print(traceback.format_exc()) raise HTTPException(status_code=500, detail=f"An unexpected error occurred: {str(e)}")
@app.post("/make_video")async def make_video(request: Request):modules/app.py+25