Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,7 +142,7 @@ def save_to_csv(data, csv_path="output/forms.csv"):
|
|
| 142 |
raise gr.Error(f"Failed to save to CSV: {e}")
|
| 143 |
|
| 144 |
# =============================================================================
|
| 145 |
-
# CORE AI PROCESSING FUNCTIONS - Main
|
| 146 |
# =============================================================================
|
| 147 |
|
| 148 |
def extract_fields_from_image(image_path, progress=None):
|
|
@@ -216,7 +216,7 @@ def extract_fields_from_image(image_path, progress=None):
|
|
| 216 |
|
| 217 |
# Smart resizing: Balance quality vs speed for CPU processing
|
| 218 |
original_size = image.size
|
| 219 |
-
max_size =
|
| 220 |
if image.width > max_size or image.height > max_size:
|
| 221 |
print(f"[Image] Resizing from {image.size} to fit {max_size}px...")
|
| 222 |
image.thumbnail((max_size, max_size), Image.Resampling.BICUBIC)
|
|
|
|
| 142 |
raise gr.Error(f"Failed to save to CSV: {e}")
|
| 143 |
|
| 144 |
# =============================================================================
|
| 145 |
+
# CORE AI PROCESSING FUNCTIONS - Main logic for form field extraction
|
| 146 |
# =============================================================================
|
| 147 |
|
| 148 |
def extract_fields_from_image(image_path, progress=None):
|
|
|
|
| 216 |
|
| 217 |
# Smart resizing: Balance quality vs speed for CPU processing
|
| 218 |
original_size = image.size
|
| 219 |
+
max_size = 1024
|
| 220 |
if image.width > max_size or image.height > max_size:
|
| 221 |
print(f"[Image] Resizing from {image.size} to fit {max_size}px...")
|
| 222 |
image.thumbnail((max_size, max_size), Image.Resampling.BICUBIC)
|