caddis commited on
Commit
81abc3a
·
1 Parent(s): 46e3b64

add filename

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -344,7 +344,7 @@ def create_demo():
344
  )
345
 
346
  # Analyze images
347
- def analyze_images(image_paths, model_choice, length_choice, filenames, content_type_choice):
348
  if not image_paths:
349
  return [], [], 0, None, "0 of 0", "No images uploaded to analyze.", None
350
 
@@ -356,7 +356,7 @@ def create_demo():
356
  image_id = filenames[i] if i < len(filenames) and filenames[i] else f"Image_{i+1}_{os.path.basename(image_path)}"
357
  try:
358
  img = Image.open(image_path)
359
- user_prompt_filename = image_id if use_filename_in_prompt else None
360
  prompt0 = prompt_new(user_prompt_filename)
361
  model_name = model_choice
362
  client_to_use = OR # Default client
@@ -404,7 +404,7 @@ def create_demo():
404
  # Connect analyze button
405
  analyze_button.click(
406
  fn=analyze_images,
407
- inputs=[image_state, model_choice, length_choice, filename_state, content_type],
408
  outputs=[all_images, all_results, current_index, current_image, image_counter,
409
  analysis_text, csv_download]
410
  )
 
344
  )
345
 
346
  # Analyze images
347
+ def analyze_images(image_paths, model_choice, length_choice, filenames, content_type_choice, include_filename):
348
  if not image_paths:
349
  return [], [], 0, None, "0 of 0", "No images uploaded to analyze.", None
350
 
 
356
  image_id = filenames[i] if i < len(filenames) and filenames[i] else f"Image_{i+1}_{os.path.basename(image_path)}"
357
  try:
358
  img = Image.open(image_path)
359
+ user_prompt_filename = image_id if include_filename else None
360
  prompt0 = prompt_new(user_prompt_filename)
361
  model_name = model_choice
362
  client_to_use = OR # Default client
 
404
  # Connect analyze button
405
  analyze_button.click(
406
  fn=analyze_images,
407
+ inputs=[image_state, model_choice, length_choice, filename_state, content_type, use_filename_in_prompt],
408
  outputs=[all_images, all_results, current_index, current_image, image_counter,
409
  analysis_text, csv_download]
410
  )