Workpam commited on
Commit
dc38609
·
verified ·
1 Parent(s): be43e95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -546,26 +546,30 @@ gr.HTML("""
546
  """)
547
 
548
  def process_all(mode, workbook_file, ups, pu, fmt, w, h):
549
- # 📄 Workbook mode
550
  if mode.startswith("📄"):
551
  data, msg = read_uploaded_workbook(workbook_file)
 
552
  if not data:
553
- # no links just show the fetch‑error
554
  return [], None, msg, None
555
- # got a list of dicts → process them
556
- return process_and_zip(data, fmt, w, h)
557
 
558
- # 📤 Direct image files
 
 
 
 
559
  if mode.startswith("📤") and ups:
560
  return process_uploaded_images(ups, fmt, w, h)
561
 
562
- # 🔗 Single URL
563
  if pu and pu.strip():
564
  return process_single_url_image(pu, fmt, w, h)
565
 
566
- # nothing valid
567
  return [], None, "⚠️ No valid input provided", None
568
 
 
569
  with gr.Blocks(css=css) as demo:
570
  # ─── States ───
571
  image_data_state = gr.State([])
 
546
  """)
547
 
548
  def process_all(mode, workbook_file, ups, pu, fmt, w, h):
549
+ # 1️⃣ If workbook mode, read links from Excel
550
  if mode.startswith("📄"):
551
  data, msg = read_uploaded_workbook(workbook_file)
552
+ print("💡 DEBUG – links extracted:", data) # <<< DEBUG
553
  if not data:
554
+ # no links or error reading
555
  return [], None, msg, None
 
 
556
 
557
+ # we have a list of {"url":…, "name":…}
558
+ files, zip_path, proc_msg, tmp = process_and_zip(data, fmt, w, h)
559
+ return files, zip_path, f"{msg}\n{proc_msg}", tmp
560
+
561
+ # 2️⃣ If “Upload Images” mode
562
  if mode.startswith("📤") and ups:
563
  return process_uploaded_images(ups, fmt, w, h)
564
 
565
+ # 3️⃣ If single‑URL mode
566
  if pu and pu.strip():
567
  return process_single_url_image(pu, fmt, w, h)
568
 
569
+ # 4️⃣ Nothing valid
570
  return [], None, "⚠️ No valid input provided", None
571
 
572
+
573
  with gr.Blocks(css=css) as demo:
574
  # ─── States ───
575
  image_data_state = gr.State([])