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