Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -509,8 +509,7 @@ def json_to_excel(contract_summary, json_data, excel_path):
|
|
| 509 |
def extract_po(docx_path):
|
| 510 |
"""Processes a single .docx file, extracts tables, formats with OpenAI, and saves as an Excel file."""
|
| 511 |
if not os.path.exists(docx_path) or not docx_path.endswith(".docx"):
|
| 512 |
-
|
| 513 |
-
return
|
| 514 |
|
| 515 |
# Read the .docx file as bytes
|
| 516 |
with open(docx_path, "rb") as f:
|
|
@@ -576,4 +575,4 @@ interface = gr.Interface(
|
|
| 576 |
theme=Base()
|
| 577 |
)
|
| 578 |
|
| 579 |
-
interface.launch()
|
|
|
|
| 509 |
def extract_po(docx_path):
|
| 510 |
"""Processes a single .docx file, extracts tables, formats with OpenAI, and saves as an Excel file."""
|
| 511 |
if not os.path.exists(docx_path) or not docx_path.endswith(".docx"):
|
| 512 |
+
raise ValueError(f"Invalid file: {docx_path}")
|
|
|
|
| 513 |
|
| 514 |
# Read the .docx file as bytes
|
| 515 |
with open(docx_path, "rb") as f:
|
|
|
|
| 575 |
theme=Base()
|
| 576 |
)
|
| 577 |
|
| 578 |
+
interface.launch(ssr_mode=False)
|