File size: 534 Bytes
8387f59
 
e139a31
8387f59
5fbd44e
e139a31
 
8387f59
 
 
5fbd44e
 
 
8387f59
 
5fbd44e
8387f59
5fbd44e
8387f59
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from fastapi import FastAPI, File, Form, UploadFile
import shutil
import os
app = FastAPI()

os.mkdir('./tarun_1234')

@app.post("/save_audio")
async def save_audio(audio: UploadFile = File(...), path: str = Form(...)):
    
    print("Received Audio !!!!!")

    # Save the audio to the specified path
    with open(path, "wb") as buffer:
        shutil.copyfileobj(audio.file, buffer)

    return {"message": "Audio saved successfully"}

if __name__ == '__main__':
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=7860)