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)