Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,13 +19,13 @@ UPLOAD_DIR.mkdir(exist_ok=True)
|
|
| 19 |
@app.post("/upload")
|
| 20 |
async def upload_file(file: UploadFile = File(...)):
|
| 21 |
print(file)
|
| 22 |
-
file_path = file.filename
|
| 23 |
with file_path.open("wb") as buffer:
|
| 24 |
shutil.copyfileobj(file.file, buffer)
|
| 25 |
|
| 26 |
# result = process_with_langchain(file_path)
|
| 27 |
|
| 28 |
-
loader = DoclingLoader(file_path=file_path, export_type=ExportType.MARKDOWN)
|
| 29 |
docs = loader.load()
|
| 30 |
# docs = docs.model_dump()
|
| 31 |
return {
|
|
|
|
| 19 |
@app.post("/upload")
|
| 20 |
async def upload_file(file: UploadFile = File(...)):
|
| 21 |
print(file)
|
| 22 |
+
file_path = Path(file.filename)
|
| 23 |
with file_path.open("wb") as buffer:
|
| 24 |
shutil.copyfileobj(file.file, buffer)
|
| 25 |
|
| 26 |
# result = process_with_langchain(file_path)
|
| 27 |
|
| 28 |
+
loader = DoclingLoader(file_path=str(file_path), export_type=ExportType.MARKDOWN)
|
| 29 |
docs = loader.load()
|
| 30 |
# docs = docs.model_dump()
|
| 31 |
return {
|