whisper-api / main.py
mkozak's picture
ahoy
94b73ef unverified
raw
history blame
527 Bytes
import replicate
from pydantic import BaseModel
from fastapi import FastAPI
class URLPayload(BaseModel):
url: str
app = FastAPI()
def process_audio(url: str):
deployment = replicate.deployments.get("meal/incredibly-fast-whisper")
prediction = deployment.predictions.create(
input={ "audio": url }
)
prediction.wait()
return prediction.output
@app.post("/process/")
async def process_audio_endpoint(payload: URLPayload):
result = process_audio(payload.url)
return result