multimodalart HF staff commited on
Commit
6477254
1 Parent(s): 0af49b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -42,7 +42,8 @@ def load_captioning(uploaded_images, concept_sentence):
42
  uploaded_images = [file for file in uploaded_images if not file.endswith('.txt')]
43
  txt_files = [file for file in uploaded_images if file.endswith('.txt')]
44
  txt_files_dict = {os.path.splitext(os.path.basename(txt_file))[0]: txt_file for txt_file in txt_files}
45
-
 
46
  gr.Info("Images uploaded!")
47
  updates = []
48
  if len(uploaded_images) <= 1:
@@ -69,7 +70,10 @@ def load_captioning(uploaded_images, concept_sentence):
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_files_dict:
 
73
  with open(txt_files_dict[base_name], 'r') as file:
74
  corresponding_caption = file.read()
75
 
 
42
  uploaded_images = [file for file in uploaded_images if not file.endswith('.txt')]
43
  txt_files = [file for file in uploaded_images if file.endswith('.txt')]
44
  txt_files_dict = {os.path.splitext(os.path.basename(txt_file))[0]: txt_file for txt_file in txt_files}
45
+ print(txt_files)
46
+ print(txt_files_dict)
47
  gr.Info("Images uploaded!")
48
  updates = []
49
  if len(uploaded_images) <= 1:
 
70
  corresponding_caption = False
71
  if(image_value):
72
  base_name = os.path.splitext(os.path.basename(image_value))[0]
73
+ print(base_name)
74
+ print(image_value)
75
  if base_name in txt_files_dict:
76
+ print("entrou")
77
  with open(txt_files_dict[base_name], 'r') as file:
78
  corresponding_caption = file.read()
79