NEHASHETTY13 commited on
Commit
e82472f
·
verified ·
1 Parent(s): 87aa449

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -316,22 +316,17 @@ def run_pipeline(image):
316
 
317
  df = pd.DataFrame(results).drop(columns=["bbox"], errors="ignore")
318
 
319
- # OCR Output
320
- ocr_df = df[["Terminal", "Wire"]].copy()
321
-
322
- # Verification Output
323
- verify_df = df[["Terminal", "Wire", "Verification"]].copy()
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
- # Status message
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