Satyam-Singh commited on
Commit
b9bc886
·
verified ·
1 Parent(s): b54fbd0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ from fastapi import FastAPI, File, UploadFile
4
+ from llava import main
5
+ import shutil
6
+
7
+ app = FastAPI()
8
+
9
+ @app.post("/process_audio/")
10
+ async def process_audio(file: UploadFile = File(...)):
11
+ # Save uploaded file to a temporary location
12
+ file_path = f"temp_{file.filename}"
13
+ with open(file_path, "wb") as buffer:
14
+ shutil.copyfileobj(file.file, buffer)
15
+
16
+ # Call the main function from llava.py to process the file
17
+ response_audio = main(file_path)
18
+
19
+ return {"response_audio": response_audio}