Update app.py
Browse files
app.py
CHANGED
@@ -1141,15 +1141,18 @@ def display_images_and_wikipedia_summaries(num_columns=4):
|
|
1141 |
|
1142 |
for image_file in image_files_sorted:
|
1143 |
with cols[col_index % num_columns]: # Cycle through columns based on num_columns
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
|
|
|
|
|
|
1153 |
|
1154 |
col_index += 1 # Increment to move to the next column in the next iteration
|
1155 |
|
|
|
1141 |
|
1142 |
for image_file in image_files_sorted:
|
1143 |
with cols[col_index % num_columns]: # Cycle through columns based on num_columns
|
1144 |
+
try:
|
1145 |
+
image = Image.open(image_file)
|
1146 |
+
st.image(image, caption=image_file, use_column_width=True)
|
1147 |
+
k = image_file.split('.')[0] # Assumes keyword is the file name without extension
|
1148 |
+
display_glossary_entity(k)
|
1149 |
+
|
1150 |
+
# Add text input for image file
|
1151 |
+
image_text_input = st.text_input(f"Image Prompt for {image_file}", key=f"image_prompt_{image_file}")
|
1152 |
+
if image_text_input:
|
1153 |
+
process_image(image_file, image_text_input)
|
1154 |
+
except:
|
1155 |
+
errored = True
|
1156 |
|
1157 |
col_index += 1 # Increment to move to the next column in the next iteration
|
1158 |
|