Chrunos commited on
Commit
63f8901
·
verified ·
1 Parent(s): a775fb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -17,6 +17,7 @@ from fastapi import BackgroundTasks
17
  from collections import defaultdict
18
  import time
19
  from datetime import timedelta
 
20
 
21
 
22
  # Set up logging
@@ -218,7 +219,8 @@ def download_track(request: DownloadRequest):
218
  # Remove spaces from the relative path
219
  download_url = f"{BASE_URL}/downloads/{relative_path}"
220
  logger.info(f"Download successful: {download_url}")
221
- return {"download_url": download_url}
 
222
  except Exception as e:
223
  logger.error(f"Error downloading track: {e}")
224
  raise HTTPException(status_code=500, detail=str(e))
 
17
  from collections import defaultdict
18
  import time
19
  from datetime import timedelta
20
+ import gc
21
 
22
 
23
  # Set up logging
 
219
  # Remove spaces from the relative path
220
  download_url = f"{BASE_URL}/downloads/{relative_path}"
221
  logger.info(f"Download successful: {download_url}")
222
+ gc.collect()
223
+ return {"download_url": download_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
224
  except Exception as e:
225
  logger.error(f"Error downloading track: {e}")
226
  raise HTTPException(status_code=500, detail=str(e))