Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -79,9 +79,12 @@ async def process_analysis_request(request: Request):
|
|
| 79 |
|
| 80 |
with tempfile.TemporaryDirectory() as work_dir:
|
| 81 |
work_path = Path(work_dir)
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
# --- Two-Pass Logic to Reliably Find the Question File ---
|
| 87 |
all_filenames = list(file_contents.keys())
|
|
|
|
| 79 |
|
| 80 |
with tempfile.TemporaryDirectory() as work_dir:
|
| 81 |
work_path = Path(work_dir)
|
| 82 |
+
form_data = await request.form()
|
| 83 |
+
all_files: List[UploadFile] = [part for part in form_data.values() if isinstance(part, UploadFile) and part.filename]
|
| 84 |
+
if not all_files: raise HTTPException(status.HTTP_400_BAD_REQUEST, "No files were uploaded.")
|
| 85 |
+
|
| 86 |
+
# This line now uses the correct variable name 'all_files'
|
| 87 |
+
file_contents = {f.filename: await f.read() for f in all_files}
|
| 88 |
|
| 89 |
# --- Two-Pass Logic to Reliably Find the Question File ---
|
| 90 |
all_filenames = list(file_contents.keys())
|