LalitMahale
commited on
Commit
·
eed80a2
1
Parent(s):
e95de35
catch dir added
Browse files
app.py
CHANGED
|
@@ -2,8 +2,13 @@ from fastapi import FastAPI, HTTPException,UploadFile,File
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from deep_translator import GoogleTranslator
|
| 4 |
from fastapi.responses import JSONResponse
|
|
|
|
| 5 |
from main import process,audio_process
|
| 6 |
# Create the FastAPI app instance
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
|
|
@@ -33,7 +38,7 @@ async def chatbot(text: str = ""):
|
|
| 33 |
return {"result": result}
|
| 34 |
|
| 35 |
@app.post("/audio_chat")
|
| 36 |
-
async def
|
| 37 |
if not audio:
|
| 38 |
raise HTTPException(status_code=400, detail="No audio file provided")
|
| 39 |
|
|
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from deep_translator import GoogleTranslator
|
| 4 |
from fastapi.responses import JSONResponse
|
| 5 |
+
import os
|
| 6 |
from main import process,audio_process
|
| 7 |
# Create the FastAPI app instance
|
| 8 |
+
os.makedirs("/tmp/huggingface_cache", exist_ok=True)
|
| 9 |
+
os.environ["HF_HOME"] = "/tmp/huggingface_cache"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
app = FastAPI()
|
| 13 |
|
| 14 |
|
|
|
|
| 38 |
return {"result": result}
|
| 39 |
|
| 40 |
@app.post("/audio_chat")
|
| 41 |
+
async def audio_chat(audio: UploadFile = File(...)):
|
| 42 |
if not audio:
|
| 43 |
raise HTTPException(status_code=400, detail="No audio file provided")
|
| 44 |
|