Spaces:
Running
Running
Commit
·
1cc9cdc
1
Parent(s):
dbaeac5
Major update. Support for 15 LLMs, World Flora Online taxonomy validation, geolocation, 2 OCR methods, significant UI changes, stability improvements, consistent JSON parsing
Browse files
app.py
CHANGED
|
@@ -232,6 +232,7 @@ def show_gallery_small():
|
|
| 232 |
|
| 233 |
@st.cache_data
|
| 234 |
def show_gallery_small_hf(images_to_display):
|
|
|
|
| 235 |
st.image(images_to_display)
|
| 236 |
|
| 237 |
|
|
@@ -285,14 +286,17 @@ def content_input_images(col_left, col_right):
|
|
| 285 |
# Update the input list for each page image
|
| 286 |
converted_files = os.listdir(st.session_state['dir_uploaded_images'])
|
| 287 |
for file_name in converted_files:
|
| 288 |
-
if file_name.
|
| 289 |
jpg_file_path = os.path.join(st.session_state['dir_uploaded_images'], file_name)
|
| 290 |
st.session_state['input_list'].append(jpg_file_path)
|
| 291 |
|
| 292 |
# Optionally, create a thumbnail for the gallery
|
| 293 |
img = Image.open(jpg_file_path)
|
| 294 |
img.thumbnail((GALLERY_IMAGE_SIZE, GALLERY_IMAGE_SIZE), Image.Resampling.LANCZOS)
|
| 295 |
-
|
|
|
|
|
|
|
|
|
|
| 296 |
st.session_state['input_list_small'].append(file_path_small)
|
| 297 |
|
| 298 |
else:
|
|
|
|
| 232 |
|
| 233 |
@st.cache_data
|
| 234 |
def show_gallery_small_hf(images_to_display):
|
| 235 |
+
print(images_to_display)
|
| 236 |
st.image(images_to_display)
|
| 237 |
|
| 238 |
|
|
|
|
| 286 |
# Update the input list for each page image
|
| 287 |
converted_files = os.listdir(st.session_state['dir_uploaded_images'])
|
| 288 |
for file_name in converted_files:
|
| 289 |
+
if file_name.split('.')[1].lower() in ['jpg','jpeg']:
|
| 290 |
jpg_file_path = os.path.join(st.session_state['dir_uploaded_images'], file_name)
|
| 291 |
st.session_state['input_list'].append(jpg_file_path)
|
| 292 |
|
| 293 |
# Optionally, create a thumbnail for the gallery
|
| 294 |
img = Image.open(jpg_file_path)
|
| 295 |
img.thumbnail((GALLERY_IMAGE_SIZE, GALLERY_IMAGE_SIZE), Image.Resampling.LANCZOS)
|
| 296 |
+
try:
|
| 297 |
+
file_path_small = save_uploaded_file(st.session_state['dir_uploaded_images_small'], file_name, img)
|
| 298 |
+
except:
|
| 299 |
+
file_path_small = save_uploaded_file_local(st.session_state['dir_uploaded_images_small'],st.session_state['dir_uploaded_images_small'], file_name, img)
|
| 300 |
st.session_state['input_list_small'].append(file_path_small)
|
| 301 |
|
| 302 |
else:
|