multimodalart HF staff commited on
Commit
a329b11
1 Parent(s): 204ae87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -68,7 +68,7 @@ def load_captioning(uploaded_images, concept_sentence):
68
 
69
  corresponding_caption = False
70
  if(image_value):
71
- base_name = os.path.splitext(os.path.basename(image))[0]
72
  if base_name in txt_file_dict:
73
  with open(txt_file_dict[base_name], 'r') as file:
74
  corresponding_caption = file.read()
@@ -85,6 +85,9 @@ def load_captioning(uploaded_images, concept_sentence):
85
  updates.append(gr.update(placeholder=f"A {concept_sentence} in a mall"))
86
  return updates
87
 
 
 
 
88
  def create_dataset(*inputs):
89
  print("Creating dataset")
90
  images = inputs[0]
@@ -464,6 +467,10 @@ with gr.Blocks(theme=theme, css=css) as demo:
464
  inputs=[steps],
465
  outputs=[cost_preview, cost_preview_info, payment_update, start]
466
  )
 
 
 
 
467
  gr.on(
468
  triggers=[steps.change, payment_update.click],
469
  fn=update_pricing,
 
68
 
69
  corresponding_caption = False
70
  if(image_value):
71
+ base_name = os.path.splitext(os.path.basename(image_value))[0]
72
  if base_name in txt_file_dict:
73
  with open(txt_file_dict[base_name], 'r') as file:
74
  corresponding_caption = file.read()
 
85
  updates.append(gr.update(placeholder=f"A {concept_sentence} in a mall"))
86
  return updates
87
 
88
+ def hide_captioning():
89
+ return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
90
+
91
  def create_dataset(*inputs):
92
  print("Creating dataset")
93
  images = inputs[0]
 
467
  inputs=[steps],
468
  outputs=[cost_preview, cost_preview_info, payment_update, start]
469
  )
470
+ images.clear(
471
+ hide_captioning,
472
+ outputs=[captioning_area, cost_preview, start]
473
+ )
474
  gr.on(
475
  triggers=[steps.change, payment_update.click],
476
  fn=update_pricing,