from fastapi import FastAPI import uvicorn from whisper_live.server import TranscriptionServer app = FastAPI(title="Whisper Live Server") @app.on_event("startup") async def startup_event(): # Start the transcription server in the background server = TranscriptionServer() server.run( host="0.0.0.0", port=7860, # Hugging Face Spaces uses port 7860 backend="faster_whisper", # Using faster_whisper as the backend single_model=True # Use single model mode for better resource usage ) @app.get("/health") def health_check(): return {"status": "healthy"} if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=7860)