Spaces:
Sleeping
Sleeping
File size: 305 Bytes
dfe177d caff3cc dfe177d |
1 2 3 4 5 6 7 8 9 10 11 12 |
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 |