Chris Addis commited on
Commit
46d47e4
·
1 Parent(s): 7c12277

different design

Browse files
Files changed (1) hide show
  1. app.py +11 -23
app.py CHANGED
@@ -186,7 +186,7 @@ def create_demo():
186
  # Left panel - Controls
187
  with gr.Column(scale=1, elem_classes="control-panel"):
188
  # Upload area with styling
189
- with gr.Box(elem_classes="upload-box"):
190
  upload_button = gr.UploadButton(
191
  "📷 Upload Images",
192
  file_types=["image"],
@@ -196,7 +196,7 @@ def create_demo():
196
  gr.Markdown("*Drag and drop or click to upload multiple images*")
197
 
198
  # Options card
199
- with gr.Box(elem_classes="model-card"):
200
  gr.Markdown("### Model Settings")
201
 
202
  # Model selection dropdown
@@ -230,32 +230,27 @@ def create_demo():
230
  gr.Markdown("### Response Length")
231
  with gr.Row(elem_classes="length-selector"):
232
  length_choice = gr.Radio(
233
- choices=[
234
- ("Short (max 130 chars)", "short"),
235
- ("Medium (250-300 chars)", "medium"),
236
- ("Long (max 450 chars)", "long")
237
- ],
238
- label="",
239
  value="medium",
240
- show_label=False
241
  )
242
 
243
  # Image preview gallery
244
- with gr.Box(elem_classes="gallery-container"):
245
  gr.Markdown("### Uploaded Images")
246
  input_gallery = gr.Gallery(
247
  label="",
248
  columns=3,
249
  height=180,
250
- object_fit="contain",
251
- allow_preview=True
252
  )
253
 
254
  # Analysis button
255
  analyze_button = gr.Button("🔍 Analyze Images", variant="primary", size="lg")
256
 
257
  # CSV Download section
258
- with gr.Box(visible=False, elem_id="download-section", elem_classes="model-card") as download_section:
259
  gr.Markdown("### Download Results")
260
  csv_download = gr.File(label="CSV Results", elem_id="csv-download")
261
 
@@ -265,7 +260,7 @@ def create_demo():
265
 
266
  # Right panel - Results display
267
  with gr.Column(scale=2, elem_classes="results-panel"):
268
- with gr.Box(elem_classes="result-container"):
269
  # Progress indicator
270
  with gr.Row(elem_id="progress-container", visible=False) as progress_container:
271
  with gr.Column():
@@ -338,12 +333,7 @@ def create_demo():
338
  return [], [], 0, "", "No images uploaded", "", gr.update(visible=False)
339
 
340
  # Get system prompt based on length selection
341
- if isinstance(length_choice, tuple):
342
- length_value = length_choice[1] # Extract the value part
343
- else:
344
- length_value = length_choice
345
-
346
- sys_prompt = get_sys_prompt(length_value)
347
 
348
  image_results = []
349
 
@@ -359,10 +349,8 @@ def create_demo():
359
  img = Image.open(image_path)
360
  prompt0 = prompt_new()
361
 
362
- # Extract model name
363
  model_name = model_choice
364
- if isinstance(model_choice, tuple):
365
- model_name = model_choice[1]
366
 
367
  # Check if this is one of the Gemini models
368
  is_gemini_model = "gemini-2.5-pro" in model_name or "gemini-2.0-flash-thinking" in model_name
 
186
  # Left panel - Controls
187
  with gr.Column(scale=1, elem_classes="control-panel"):
188
  # Upload area with styling
189
+ with gr.Column(elem_classes="upload-box"):
190
  upload_button = gr.UploadButton(
191
  "📷 Upload Images",
192
  file_types=["image"],
 
196
  gr.Markdown("*Drag and drop or click to upload multiple images*")
197
 
198
  # Options card
199
+ with gr.Column(elem_classes="model-card"):
200
  gr.Markdown("### Model Settings")
201
 
202
  # Model selection dropdown
 
230
  gr.Markdown("### Response Length")
231
  with gr.Row(elem_classes="length-selector"):
232
  length_choice = gr.Radio(
233
+ choices=["short", "medium", "long"],
234
+ label="Response Length",
 
 
 
 
235
  value="medium",
236
+ info="Short: max 130 chars | Medium: 250-300 chars | Long: max 450 chars"
237
  )
238
 
239
  # Image preview gallery
240
+ with gr.Column(elem_classes="gallery-container"):
241
  gr.Markdown("### Uploaded Images")
242
  input_gallery = gr.Gallery(
243
  label="",
244
  columns=3,
245
  height=180,
246
+ object_fit="contain"
 
247
  )
248
 
249
  # Analysis button
250
  analyze_button = gr.Button("🔍 Analyze Images", variant="primary", size="lg")
251
 
252
  # CSV Download section
253
+ with gr.Column(visible=False, elem_id="download-section", elem_classes="model-card") as download_section:
254
  gr.Markdown("### Download Results")
255
  csv_download = gr.File(label="CSV Results", elem_id="csv-download")
256
 
 
260
 
261
  # Right panel - Results display
262
  with gr.Column(scale=2, elem_classes="results-panel"):
263
+ with gr.Column(elem_classes="result-container"):
264
  # Progress indicator
265
  with gr.Row(elem_id="progress-container", visible=False) as progress_container:
266
  with gr.Column():
 
333
  return [], [], 0, "", "No images uploaded", "", gr.update(visible=False)
334
 
335
  # Get system prompt based on length selection
336
+ sys_prompt = get_sys_prompt(length_choice)
 
 
 
 
 
337
 
338
  image_results = []
339
 
 
349
  img = Image.open(image_path)
350
  prompt0 = prompt_new()
351
 
352
+ # Use model_choice directly since it's the internal value
353
  model_name = model_choice
 
 
354
 
355
  # Check if this is one of the Gemini models
356
  is_gemini_model = "gemini-2.5-pro" in model_name or "gemini-2.0-flash-thinking" in model_name