Spaces:
Paused
Paused
Update admin_routes.py
Browse files- admin_routes.py +19 -1
admin_routes.py
CHANGED
|
@@ -1591,7 +1591,25 @@ async def generate_tts(
|
|
| 1591 |
model_id=request.model_id,
|
| 1592 |
output_format=request.output_format
|
| 1593 |
)
|
| 1594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1595 |
# ===================== Activity Log Endpoints =====================
|
| 1596 |
@router.get("/activity-log")
|
| 1597 |
async def get_activity_log(
|
|
|
|
| 1591 |
model_id=request.model_id,
|
| 1592 |
output_format=request.output_format
|
| 1593 |
)
|
| 1594 |
+
# Return audio data
|
| 1595 |
+
from fastapi.responses import Response
|
| 1596 |
+
|
| 1597 |
+
content_type = "audio/mpeg" if request.output_format.startswith("mp3") else "audio/wav"
|
| 1598 |
+
|
| 1599 |
+
return Response(
|
| 1600 |
+
content=audio_data,
|
| 1601 |
+
media_type=content_type,
|
| 1602 |
+
headers={
|
| 1603 |
+
"Content-Disposition": f"attachment; filename=tts_output.{request.output_format.split('_')[0]}"
|
| 1604 |
+
}
|
| 1605 |
+
)
|
| 1606 |
+
|
| 1607 |
+
except HTTPException:
|
| 1608 |
+
raise
|
| 1609 |
+
except Exception as e:
|
| 1610 |
+
log(f"❌ TTS generation error: {e}")
|
| 1611 |
+
raise HTTPException(status_code=500, detail=str(e))
|
| 1612 |
+
|
| 1613 |
# ===================== Activity Log Endpoints =====================
|
| 1614 |
@router.get("/activity-log")
|
| 1615 |
async def get_activity_log(
|