Update app.py
Browse files
app.py
CHANGED
|
@@ -316,22 +316,17 @@ def run_pipeline(image):
|
|
| 316 |
|
| 317 |
df = pd.DataFrame(results).drop(columns=["bbox"], errors="ignore")
|
| 318 |
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
# Save file
|
| 326 |
-
import tempfile
|
| 327 |
-
|
| 328 |
-
tmp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".xlsx")
|
| 329 |
-
file_path = tmp_file.name
|
| 330 |
|
|
|
|
| 331 |
verify_df.to_excel(file_path, index=False)
|
| 332 |
|
| 333 |
-
|
| 334 |
-
status = "✅ Verification Completed" if len(df) > 0 else "⚠️ No detections found"
|
| 335 |
|
| 336 |
return vis, ocr_df, verify_df, file_path, status
|
| 337 |
|
|
|
|
| 316 |
|
| 317 |
df = pd.DataFrame(results).drop(columns=["bbox"], errors="ignore")
|
| 318 |
|
| 319 |
+
if df.empty:
|
| 320 |
+
ocr_df = pd.DataFrame(columns=["Terminal", "Wire"])
|
| 321 |
+
verify_df = pd.DataFrame(columns=["Terminal", "Wire", "Verification"])
|
| 322 |
+
else:
|
| 323 |
+
ocr_df = df[["Terminal", "Wire"]].copy()
|
| 324 |
+
verify_df = df[["Terminal", "Wire", "Verification"]].copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
+
file_path = "terminal_result.xlsx"
|
| 327 |
verify_df.to_excel(file_path, index=False)
|
| 328 |
|
| 329 |
+
status = "✅ Verification Completed" if not df.empty else "⚠️ No detections found"
|
|
|
|
| 330 |
|
| 331 |
return vis, ocr_df, verify_df, file_path, status
|
| 332 |
|