Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -176,9 +176,10 @@ if uploaded_files:
|
|
| 176 |
# Table Extraction
|
| 177 |
# L = []
|
| 178 |
output_list = []
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
|
|
|
| 182 |
with NamedTemporaryFile(dir=".", suffix=".json") as f:
|
| 183 |
elements_to_json(elements, filename=f"{f.name.split('/')[-1]}")
|
| 184 |
json_file_path = os.path.abspath(f.name) # Get the absolute file path
|
|
|
|
| 176 |
# Table Extraction
|
| 177 |
# L = []
|
| 178 |
output_list = []
|
| 179 |
+
try:
|
| 180 |
+
elements = partition_pdf(filename=pdf.name, strategy=strategy, infer_table_structure=True, model_name=model_name)
|
| 181 |
+
except:
|
| 182 |
+
elements = partition_pdf(filename=pdf.name, strategy=strategy, infer_table_structure=True)
|
| 183 |
with NamedTemporaryFile(dir=".", suffix=".json") as f:
|
| 184 |
elements_to_json(elements, filename=f"{f.name.split('/')[-1]}")
|
| 185 |
json_file_path = os.path.abspath(f.name) # Get the absolute file path
|