Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,11 +25,11 @@ async def upload_file(file: UploadFile = File(...)):
|
|
| 25 |
# shutil.copyfileobj(file.file, buffer)
|
| 26 |
|
| 27 |
with tempfile.NamedTemporaryFile(delete=False, suffix=file.filename) as temp_file:
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
# result = process_with_langchain(file_path)
|
| 35 |
|
|
|
|
| 25 |
# shutil.copyfileobj(file.file, buffer)
|
| 26 |
|
| 27 |
with tempfile.NamedTemporaryFile(delete=False, suffix=file.filename) as temp_file:
|
| 28 |
+
# Efficiently write the uploaded file's content to the temporary file
|
| 29 |
+
contents = await file.read()
|
| 30 |
+
temp_file.write(contents)
|
| 31 |
|
| 32 |
+
temp_file_path = temp_file.name
|
| 33 |
|
| 34 |
# result = process_with_langchain(file_path)
|
| 35 |
|