Spaces:
Build error
Build error
Commit
Β·
a118576
1
Parent(s):
ac59367
Fix async/await issue in process_document function
Browse files
app.py
CHANGED
|
@@ -104,7 +104,7 @@ async def health_check():
|
|
| 104 |
"processed_dir": str(PROCESSED_DIR)
|
| 105 |
}
|
| 106 |
|
| 107 |
-
|
| 108 |
"""
|
| 109 |
Process a document by extracting text, summarizing it, and adding to the vector store.
|
| 110 |
|
|
@@ -195,7 +195,7 @@ async def search_documents(query: str, top_k: int = 5):
|
|
| 195 |
except Exception as e:
|
| 196 |
raise HTTPException(status_code=500, detail=str(e))
|
| 197 |
|
| 198 |
-
#
|
| 199 |
def process_file(file_path):
|
| 200 |
"""Process the uploaded file and return the summary"""
|
| 201 |
# file_path is already a string path from Gradio's type="filepath"
|
|
@@ -206,7 +206,7 @@ def process_file(file_path):
|
|
| 206 |
result = process_document(file_path)
|
| 207 |
return result.get("summary", "μμ½μ μμ±ν μ μμ΅λλ€.")
|
| 208 |
except Exception as e:
|
| 209 |
-
logger.error(f"Error processing file: {str(e)}")
|
| 210 |
return f"νμΌ μ²λ¦¬ μ€ μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}"
|
| 211 |
|
| 212 |
def search(query):
|
|
|
|
| 104 |
"processed_dir": str(PROCESSED_DIR)
|
| 105 |
}
|
| 106 |
|
| 107 |
+
def process_document(file_path: str):
|
| 108 |
"""
|
| 109 |
Process a document by extracting text, summarizing it, and adding to the vector store.
|
| 110 |
|
|
|
|
| 195 |
except Exception as e:
|
| 196 |
raise HTTPException(status_code=500, detail=str(e))
|
| 197 |
|
| 198 |
+
# GradIO μΈν°νμ΄μ€ μμ±
|
| 199 |
def process_file(file_path):
|
| 200 |
"""Process the uploaded file and return the summary"""
|
| 201 |
# file_path is already a string path from Gradio's type="filepath"
|
|
|
|
| 206 |
result = process_document(file_path)
|
| 207 |
return result.get("summary", "μμ½μ μμ±ν μ μμ΅λλ€.")
|
| 208 |
except Exception as e:
|
| 209 |
+
logger.error(f"Error processing file: {str(e)}", exc_info=True)
|
| 210 |
return f"νμΌ μ²λ¦¬ μ€ μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}"
|
| 211 |
|
| 212 |
def search(query):
|