abi3420 commited on
Commit
eff6788
·
verified ·
1 Parent(s): cb16c4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -24
app.py CHANGED
@@ -286,29 +286,7 @@ async def websocket_translation_chat(
286
  chat_manager.disconnect(session_id, user_id)
287
  await chat_manager.broadcast_room_status(session_id)
288
 
289
- # Gradio Web Interface for Hugging Face Free Spaces Hosting
290
- try:
291
- import gradio as gr
292
- demo = gr.Interface(
293
- fn=lambda x: f"Dubify AI API is Active! Status: Healthy. Input: {x}",
294
- inputs="text",
295
- outputs="text",
296
- title="Dubify AI Backend API (FastAPI + Whisper ML)",
297
- description="FastAPI service hosting Speech-to-Text, Translation, Dubbing, and Real-time QR Translation Chat."
298
- )
299
- demo.app.include_router(app.router)
300
- except Exception as grad_err:
301
- logger.warning(f"Gradio mounting skipped: {grad_err}")
302
-
303
  if __name__ == "__main__":
304
  import uvicorn
305
- if "SPACE_ID" in os.environ:
306
- try:
307
- demo.launch(ssr_mode=False)
308
- except TypeError:
309
- try:
310
- demo.launch(ssr=False)
311
- except TypeError:
312
- demo.launch()
313
- else:
314
- uvicorn.run(app, host="0.0.0.0", port=8000)
 
286
  chat_manager.disconnect(session_id, user_id)
287
  await chat_manager.broadcast_room_status(session_id)
288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  if __name__ == "__main__":
290
  import uvicorn
291
+ port = int(os.environ.get("PORT", 7860))
292
+ uvicorn.run(app, host="0.0.0.0", port=port)