Pulastya B commited on
Commit
b213e33
·
1 Parent(s): 5992afe

Fix session memory: preserve uploaded files for follow-up requests

Browse files
Files changed (1) hide show
  1. src/api/app.py +5 -7
src/api/app.py CHANGED
@@ -294,13 +294,11 @@ async def run_analysis(
294
  )
295
 
296
  finally:
297
- # Cleanup temporary file
298
- if temp_file_path and temp_file_path.exists():
299
- try:
300
- temp_file_path.unlink()
301
- logger.info(f"Cleaned up temporary file: {temp_file_path}")
302
- except Exception as e:
303
- logger.warning(f"Failed to cleanup temp file: {e}")
304
 
305
 
306
  @app.post("/profile")
 
294
  )
295
 
296
  finally:
297
+ # Keep temporary file for session continuity (follow-up requests)
298
+ # Files in /tmp are automatically cleaned up by the OS
299
+ # For HuggingFace Spaces: space restart clears /tmp
300
+ # For production: implement session-based cleanup after timeout
301
+ pass
 
 
302
 
303
 
304
  @app.post("/profile")