File size: 589 Bytes
6debc39
 
 
 
 
 
 
 
43a11da
6debc39
 
43a11da
6debc39
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from services.AudioTokenizerService import get_audio_tokenizer_service
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi import File, UploadFile
from models.audio import AudioFormat, FORMAT_BACKENDS, AudioRequest
from utils.utils import decode_base64_to_audio
import base64

audio_inference_router = APIRouter(
    prefix="/inference", tags=["audio"])


@audio_inference_router.post("")
async def tokenize_audio(request: AudioRequest):
    file_obj = decode_base64_to_audio(request.data)
    return get_audio_tokenizer_service().tokenize(file_obj, request.format)