Grinding commited on
Commit
b470e19
·
verified ·
1 Parent(s): ae78221

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +4 -4
app/main.py CHANGED
@@ -24,9 +24,9 @@ tasks = {}
24
  TEMP_DIR = Path("/tmp/temp_audio")
25
  TEMP_DIR.mkdir(exist_ok=True)
26
 
27
- # Define allowed file extensions and max size (50MB)
28
  ALLOWED_EXTENSIONS = {".wav", ".mp3", ".m4a", ".ogg", ".flac"}
29
- MAX_FILE_SIZE = 50 * 1024 * 1024
30
 
31
  @app.post("/upload")
32
  async def upload_audio_file(background_tasks: BackgroundTasks, file: UploadFile = File(...)):
@@ -45,7 +45,7 @@ async def upload_audio_file(background_tasks: BackgroundTasks, file: UploadFile
45
  # Validation: File Size
46
  file_content = await file.read()
47
  if len(file_content) > MAX_FILE_SIZE:
48
- raise HTTPException(status_code=413, detail="File too large. Limit is 50MB.")
49
 
50
  # Reset file pointer before saving
51
  await file.seek(0)
@@ -77,4 +77,4 @@ async def get_task_result(task_id: str):
77
  task = tasks.get(task_id)
78
  if not task or task.get("status") != "complete":
79
  raise HTTPException(status_code=404, detail="Result not yet available or task not found")
80
- return task.get("result")
 
24
  TEMP_DIR = Path("/tmp/temp_audio")
25
  TEMP_DIR.mkdir(exist_ok=True)
26
 
27
+ # Define allowed file extensions and max size (200MB)
28
  ALLOWED_EXTENSIONS = {".wav", ".mp3", ".m4a", ".ogg", ".flac"}
29
+ MAX_FILE_SIZE = 200 * 1024 * 1024
30
 
31
  @app.post("/upload")
32
  async def upload_audio_file(background_tasks: BackgroundTasks, file: UploadFile = File(...)):
 
45
  # Validation: File Size
46
  file_content = await file.read()
47
  if len(file_content) > MAX_FILE_SIZE:
48
+ raise HTTPException(status_code=413, detail="File too large. Limit is 200MB.")
49
 
50
  # Reset file pointer before saving
51
  await file.seek(0)
 
77
  task = tasks.get(task_id)
78
  if not task or task.get("status") != "complete":
79
  raise HTTPException(status_code=404, detail="Result not yet available or task not found")
80
+ return task.get("result")