Spaces:
Running
Running
Commit
·
0f3589f
1
Parent(s):
b55e03e
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
|
@@ -283,7 +283,16 @@ def content_input_images(col_left, col_right):
|
|
| 283 |
n_pages = convert_pdf_to_jpg(file_path, st.session_state['dir_uploaded_images'], dpi=st.session_state.config['leafmachine']['project']['dir_images_local'])
|
| 284 |
# Update the input list for each page image
|
| 285 |
converted_files = os.listdir(st.session_state['dir_uploaded_images'])
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
else:
|
| 289 |
# Handle JPG/JPEG files (existing process)
|
|
|
|
| 283 |
n_pages = convert_pdf_to_jpg(file_path, st.session_state['dir_uploaded_images'], dpi=st.session_state.config['leafmachine']['project']['dir_images_local'])
|
| 284 |
# Update the input list for each page image
|
| 285 |
converted_files = os.listdir(st.session_state['dir_uploaded_images'])
|
| 286 |
+
for file_name in converted_files:
|
| 287 |
+
if file_name.lower().endswith('.jpg'):
|
| 288 |
+
jpg_file_path = os.path.join(st.session_state['dir_uploaded_images'], file_name)
|
| 289 |
+
st.session_state['input_list'].append(jpg_file_path)
|
| 290 |
+
|
| 291 |
+
# Optionally, create a thumbnail for the gallery
|
| 292 |
+
img = Image.open(jpg_file_path)
|
| 293 |
+
img.thumbnail((GALLERY_IMAGE_SIZE, GALLERY_IMAGE_SIZE), Image.Resampling.LANCZOS)
|
| 294 |
+
file_path_small = save_uploaded_file(st.session_state['dir_uploaded_images_small'], uploaded_file, img)
|
| 295 |
+
st.session_state['input_list_small'].append(file_path_small)
|
| 296 |
|
| 297 |
else:
|
| 298 |
# Handle JPG/JPEG files (existing process)
|