|
|
|
|
|
|
|
from fastapi import FastAPI, UploadFile |
|
from fastapi.staticfiles import StaticFiles |
|
from fastapi.responses import FileResponse |
|
from audio.audioanalyser_anglais import AudioAnalyserAnglais |
|
from audio.audioanalyser_diarization import AudioAnalyserDiarization |
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
@app.get("/healthcheck") |
|
def healthcheck(): |
|
|
|
|
|
|
|
|
|
return {"output":"OK"} |
|
@app.post("/stt") |
|
async def stt(file: str = UploadFile(...)): |
|
|
|
file_content = await file.read() |
|
results = AudioAnalyserAnglais.stt(file_content) |
|
|
|
|
|
return {"output":results} |
|
|
|
|
|
@app.post("/diarization") |
|
async def diarization(file: str = UploadFile(...)): |
|
|
|
file_content = await file.read() |
|
results = AudioAnalyserDiarization.diarization(file_content) |
|
|
|
|
|
return {"output":results} |
|
|
|
|
|
|
|
@app.get("/") |
|
def index() -> FileResponse: |
|
return FileResponse(path="/home/user/app/index.html", media_type="text/html") |
|
|
|
|
|
|
|
|
|
|