I want to build an API interface, but the translation after the audio input is wrong, I think I may have made a mistake when processing the audio file, may I ask what went wrong? If there is a completed API code, can you provide it to me? Here's my code:
`import torchaudio
import torch
from seamless_communication.inference import Translator
from fastapi import FastAPI, File, UploadFile, Form
I want to build an API interface, but the translation after the audio input is wrong, I think I may have made a mistake when processing the audio file, may I ask what went wrong? If there is a completed API code, can you provide it to me? Here's my code:
`import torchaudio import torch from seamless_communication.inference import Translator from fastapi import FastAPI, File, UploadFile, Form
model_name = "seamlessM4T_v2_large" vocoder_name = "vocoder_v2" if model_name == "seamlessM4T_v2_large" else "vocoder_36langs"
translator = Translator( model_name, vocoder_name, device=torch.device("cuda:1"), dtype=torch.float16, )
app = FastAPI()
@app.post("/translate") async def translate( file: UploadFile = File(...), to_lang: str = Form(...), ): audio_input, sample_rate = torchaudio.load(file.file)
if name == "main": import uvicorn