Yaz Hobooti
commited on
Commit
·
849a30f
1
Parent(s):
465c0bc
Rewrite theme section: use only supported Gradio parameters
Browse files- Removed all unsupported theme parameters (button_text_color, body_text_color, etc.)
- Kept only core supported parameters: body_background_fill, block_background_fill, border_color_primary
- Simplified theme to avoid TypeError with unsupported parameters
- Maintains visual design with light blue background and black blocks
- pdf_comparator.py +3 -10
pdf_comparator.py
CHANGED
|
@@ -665,7 +665,7 @@ def find_misspell_boxes_from_text(
|
|
| 665 |
y1 = int(bbox[1] * scale_y) + (page_num * img_height)
|
| 666 |
x2 = int(bbox[2] * scale_x)
|
| 667 |
y2 = int(bbox[3] * scale_y) + (page_num * img_height)
|
| 668 |
-
|
| 669 |
# Use PDF coordinates directly (fallback)
|
| 670 |
x1 = int(bbox[0])
|
| 671 |
y1 = int(bbox[1]) + (page_num * 1000)
|
|
@@ -1113,6 +1113,7 @@ def compare_pdfs(file_a, file_b):
|
|
| 1113 |
# -------------------- Gradio App -------------------
|
| 1114 |
def create_demo():
|
| 1115 |
# Create custom theme with light blue background
|
|
|
|
| 1116 |
custom_theme = gr.themes.Soft(
|
| 1117 |
primary_hue="blue",
|
| 1118 |
neutral_hue="blue",
|
|
@@ -1124,14 +1125,6 @@ def create_demo():
|
|
| 1124 |
block_background_fill_dark="#000000",
|
| 1125 |
border_color_primary="#333333", # Dark borders
|
| 1126 |
border_color_primary_dark="#333333",
|
| 1127 |
-
body_text_color="#000000", # Black text
|
| 1128 |
-
body_text_color_dark="#000000",
|
| 1129 |
-
block_label_text_color="#000000", # Black text for labels
|
| 1130 |
-
block_label_text_color_dark="#000000",
|
| 1131 |
-
block_title_text_color="#000000", # Black text for titles
|
| 1132 |
-
block_title_text_color_dark="#000000",
|
| 1133 |
-
button_text_color="#FFFFFF", # White text on buttons for contrast
|
| 1134 |
-
button_text_color_dark="#FFFFFF",
|
| 1135 |
)
|
| 1136 |
|
| 1137 |
with gr.Blocks(title="PDF Comparison Tool", theme=custom_theme) as demo:
|
|
@@ -1276,7 +1269,7 @@ def debug_scan_pdf(pdf_path: str, outdir: str = "barcode_debug", max_pages=2):
|
|
| 1276 |
rr = _decode_once(pil) or _decode_once(_binarize(pil))
|
| 1277 |
if rr:
|
| 1278 |
print(f" Embedded image {ix+1}: {[(r.type, r.data) for r in rr]}")
|
| 1279 |
-
|
| 1280 |
print(" Embedded image error:", e)
|
| 1281 |
|
| 1282 |
doc.close()
|
|
|
|
| 665 |
y1 = int(bbox[1] * scale_y) + (page_num * img_height)
|
| 666 |
x2 = int(bbox[2] * scale_x)
|
| 667 |
y2 = int(bbox[3] * scale_y) + (page_num * img_height)
|
| 668 |
+
else:
|
| 669 |
# Use PDF coordinates directly (fallback)
|
| 670 |
x1 = int(bbox[0])
|
| 671 |
y1 = int(bbox[1]) + (page_num * 1000)
|
|
|
|
| 1113 |
# -------------------- Gradio App -------------------
|
| 1114 |
def create_demo():
|
| 1115 |
# Create custom theme with light blue background
|
| 1116 |
+
# Create a simple, working theme with supported parameters only
|
| 1117 |
custom_theme = gr.themes.Soft(
|
| 1118 |
primary_hue="blue",
|
| 1119 |
neutral_hue="blue",
|
|
|
|
| 1125 |
block_background_fill_dark="#000000",
|
| 1126 |
border_color_primary="#333333", # Dark borders
|
| 1127 |
border_color_primary_dark="#333333",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1128 |
)
|
| 1129 |
|
| 1130 |
with gr.Blocks(title="PDF Comparison Tool", theme=custom_theme) as demo:
|
|
|
|
| 1269 |
rr = _decode_once(pil) or _decode_once(_binarize(pil))
|
| 1270 |
if rr:
|
| 1271 |
print(f" Embedded image {ix+1}: {[(r.type, r.data) for r in rr]}")
|
| 1272 |
+
except Exception as e:
|
| 1273 |
print(" Embedded image error:", e)
|
| 1274 |
|
| 1275 |
doc.close()
|