KarthikMuraliM commited on
Commit
ec2c42e
·
verified ·
1 Parent(s): 7d847d8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -6
main.py CHANGED
@@ -78,14 +78,13 @@ async def process_analysis_request(request: Request):
78
  last_plan = {}
79
 
80
  with tempfile.TemporaryDirectory() as work_dir:
81
- # --- 1. FILE HANDLING (Using the Robust In-Memory Method) ---
82
  work_path = Path(work_dir)
83
-
84
- # Manually parse the form data from the raw request. This is the key change.
85
  form_data = await request.form()
86
- all_files: List[UploadFile] = [part for part in form_data.values() if isinstance(part, UploadFile) and part.filename]
87
-
88
- # This block correctly reads all files into memory ONCE, fixing the FileNotFoundError
 
89
  file_contents = {f.filename: await f.read() for f in all_files}
90
 
91
  # --- Now, perform the proven logic on the filenames ---
 
78
  last_plan = {}
79
 
80
  with tempfile.TemporaryDirectory() as work_dir:
 
81
  work_path = Path(work_dir)
82
+
 
83
  form_data = await request.form()
84
+ all_files: List[UploadFile] = [
85
+ part for part in form_data.values()
86
+ if isinstance(part, UploadFile) and part.filename
87
+ ]
88
  file_contents = {f.filename: await f.read() for f in all_files}
89
 
90
  # --- Now, perform the proven logic on the filenames ---