Spaces:
Sleeping
Sleeping
Update main.py
Browse files
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] = [
|
| 87 |
-
|
| 88 |
-
|
|
|
|
| 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 ---
|