File size: 685 Bytes
7222c68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)