rongo1
commited on
Commit
Β·
657f105
1
Parent(s):
d6f9d21
chore: replaced needed stuff
Browse files
app.py
CHANGED
@@ -198,7 +198,7 @@ Return format: [card1_data, card2_data, card3_data, ...]
|
|
198 |
logger.debug("Adding metadata to extracted data")
|
199 |
for i, data in enumerate(response_data):
|
200 |
# Use user-friendly model name for Excel
|
201 |
-
data['method'] = "Speed-Optimized
|
202 |
if i < len(filenames):
|
203 |
data['filename'] = filenames[i]
|
204 |
logger.debug(f"Added metadata to card {i+1}: {filenames[i]}")
|
@@ -232,7 +232,7 @@ Return format: [card1_data, card2_data, card3_data, ...]
|
|
232 |
logger.debug("Adding metadata to cleaned extracted data")
|
233 |
for i, data in enumerate(response_data):
|
234 |
# Use user-friendly model name for Excel
|
235 |
-
data['method'] = "Speed-Optimized
|
236 |
if i < len(filenames):
|
237 |
data['filename'] = filenames[i]
|
238 |
logger.debug(f"Added metadata to cleaned card {i+1}: {filenames[i]}")
|
@@ -580,7 +580,7 @@ def process_business_cards(images, model_name="gemini-2.5-flash", save_images=Tr
|
|
580 |
logger.info("Creating summary message")
|
581 |
num_batches = len(image_batches) if 'image_batches' in locals() else 1
|
582 |
summary = f"Successfully processed {len(all_data)} business card(s) in {num_batches} batch(es) of up to 5 cards.\n"
|
583 |
-
model_display = "Speed-Optimized
|
584 |
summary += f"π€ AI Model used: {model_display}\n"
|
585 |
summary += f"β‘ API calls made: {num_batches} (instead of {len(all_data)})\n"
|
586 |
|
@@ -670,7 +670,7 @@ with gr.Blocks(title="Business Card Data Extractor") as demo:
|
|
670 |
)
|
671 |
|
672 |
model_selector = gr.Dropdown(
|
673 |
-
choices=[("Accuracy-Optimized
|
674 |
value="gemini-2.5-pro",
|
675 |
label="AI Model Selection"
|
676 |
)
|
@@ -711,7 +711,7 @@ with gr.Blocks(title="Business Card Data Extractor") as demo:
|
|
711 |
gr.Markdown(
|
712 |
"""
|
713 |
## Features:
|
714 |
-
- π€ **Model Selection**: Choose between Speed-Optimized
|
715 |
- β‘ **Batch Processing**: Processes 5 cards per API call for efficiency
|
716 |
- π **Data Extraction**: Names, emails, phone numbers, addresses, and more
|
717 |
- π **Smart Combination**: Multiple emails/phones combined with commas
|
|
|
198 |
logger.debug("Adding metadata to extracted data")
|
199 |
for i, data in enumerate(response_data):
|
200 |
# Use user-friendly model name for Excel
|
201 |
+
data['method'] = "Speed-Optimized model" if "flash" in model_name else "Accuracy-Optimized model"
|
202 |
if i < len(filenames):
|
203 |
data['filename'] = filenames[i]
|
204 |
logger.debug(f"Added metadata to card {i+1}: {filenames[i]}")
|
|
|
232 |
logger.debug("Adding metadata to cleaned extracted data")
|
233 |
for i, data in enumerate(response_data):
|
234 |
# Use user-friendly model name for Excel
|
235 |
+
data['method'] = "Speed-Optimized model" if "flash" in model_name else "Accuracy-Optimized model"
|
236 |
if i < len(filenames):
|
237 |
data['filename'] = filenames[i]
|
238 |
logger.debug(f"Added metadata to cleaned card {i+1}: {filenames[i]}")
|
|
|
580 |
logger.info("Creating summary message")
|
581 |
num_batches = len(image_batches) if 'image_batches' in locals() else 1
|
582 |
summary = f"Successfully processed {len(all_data)} business card(s) in {num_batches} batch(es) of up to 5 cards.\n"
|
583 |
+
model_display = "Speed-Optimized model" if "flash" in model_name else "Accuracy-Optimized model"
|
584 |
summary += f"π€ AI Model used: {model_display}\n"
|
585 |
summary += f"β‘ API calls made: {num_batches} (instead of {len(all_data)})\n"
|
586 |
|
|
|
670 |
)
|
671 |
|
672 |
model_selector = gr.Dropdown(
|
673 |
+
choices=[("Accuracy-Optimized model", "gemini-2.5-pro"), ("Speed-Optimized model", "gemini-2.5-flash")],
|
674 |
value="gemini-2.5-pro",
|
675 |
label="AI Model Selection"
|
676 |
)
|
|
|
711 |
gr.Markdown(
|
712 |
"""
|
713 |
## Features:
|
714 |
+
- π€ **Model Selection**: Choose between Speed-Optimized model (fast) or Accuracy-Optimized model (accurate)
|
715 |
- β‘ **Batch Processing**: Processes 5 cards per API call for efficiency
|
716 |
- π **Data Extraction**: Names, emails, phone numbers, addresses, and more
|
717 |
- π **Smart Combination**: Multiple emails/phones combined with commas
|