Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
204ae87
1
Parent(s):
50b7dc1
Update app.py
Browse files
app.py
CHANGED
@@ -70,8 +70,9 @@ def load_captioning(uploaded_images, concept_sentence):
|
|
70 |
if(image_value):
|
71 |
base_name = os.path.splitext(os.path.basename(image))[0]
|
72 |
if base_name in txt_file_dict:
|
73 |
-
|
74 |
-
|
|
|
75 |
# Update value of captioning area
|
76 |
text_value = corresponding_caption if visible and corresponding_caption else "[trigger]" if visible and concept_sentence else None
|
77 |
updates.append(gr.update(value=text_value, visible=visible))
|
|
|
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()
|
75 |
+
|
76 |
# Update value of captioning area
|
77 |
text_value = corresponding_caption if visible and corresponding_caption else "[trigger]" if visible and concept_sentence else None
|
78 |
updates.append(gr.update(value=text_value, visible=visible))
|