ShobhitKori
Updated utils.py
caff3cc
raw
history blame contribute delete
305 Bytes
import os
from fastapi import UploadFile
AUDIO_DIR = "/tmp/audio_files"
os.makedirs(AUDIO_DIR, exist_ok=True)
def save_audio_file(file: UploadFile) -> str:
file_path = os.path.join(AUDIO_DIR, file.filename)
with open(file_path, "wb") as buffer:
buffer.write(file.file.read())
return file_path