Spaces:
Running
Running
phyloforfun
commited on
Commit
•
0ee709f
1
Parent(s):
697083f
file upload gallery
Browse files- app.py +43 -23
- demo/ba/ocr.png +3 -0
- demo/img/VoucherVision_Keys.PNG +3 -0
app.py
CHANGED
@@ -1297,21 +1297,32 @@ def content_header():
|
|
1297 |
st.button("Refresh", on_click=refresh)
|
1298 |
|
1299 |
with col_run_2:
|
1300 |
-
st.subheader('
|
1301 |
-
st.write('We include a single image for testing.
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
|
1316 |
with col_run_3:
|
1317 |
st.subheader('Available LLMs and APIs')
|
@@ -1335,12 +1346,16 @@ def content_tab_settings():
|
|
1335 |
st.write("---")
|
1336 |
st.header('Input Images')
|
1337 |
st.write('Upload a batch of images using the uploader below. These images will be store temporarily on this server. Each time you upload new images the ***previously uploaded images will be deleted***. You can also clear these cached images by pressing the "Clear Staged Images" button.')
|
1338 |
-
|
1339 |
-
|
|
|
|
|
|
|
1340 |
|
1341 |
st.write("---")
|
1342 |
-
st.header('
|
1343 |
-
|
|
|
1344 |
|
1345 |
os.path.join(st.session_state.dir_home, )
|
1346 |
### Project
|
@@ -1432,14 +1447,19 @@ def content_tab_settings():
|
|
1432 |
['ruler', 'barcode','label', 'colorcard','map','envelope','photo','attached_item','weights',
|
1433 |
'leaf_whole', 'leaf_partial', 'leaflet', 'seed_fruit_one', 'seed_fruit_many', 'flower_one', 'flower_many', 'bud','specimen','roots','wood'],default=default_crops)
|
1434 |
|
1435 |
-
st.subheader('Create OCR Overlay Image')
|
1436 |
-
st.write('This will plot bounding boxes around all text that Google Vision was able to detect. If there are no boxes around text, then the OCR failed, so that missing text will not be seen by the LLM when it is creating the JSON object. The created image will be viewable in the VoucherVisionEditor.')
|
1437 |
-
st.session_state.config['leafmachine']['do_create_OCR_helper_image'] = st.checkbox("Create image showing an overlay of the OCR detections", st.session_state.config['leafmachine'].get('do_create_OCR_helper_image', False))
|
1438 |
-
|
1439 |
with col_cropped_2:
|
1440 |
ba = os.path.join(st.session_state.dir_home,'demo', 'ba','ba2.png')
|
1441 |
image = Image.open(ba)
|
1442 |
st.image(image, caption='LeafMachine2 Collage', output_format = "PNG")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1443 |
|
1444 |
def content_tab_component():
|
1445 |
st.header('Archival Components')
|
|
|
1297 |
st.button("Refresh", on_click=refresh)
|
1298 |
|
1299 |
with col_run_2:
|
1300 |
+
st.subheader('Quick Start', help="")
|
1301 |
+
st.write('1. We include a single image for testing. Without uploading your own images, you can select options below and press "Start Processing" to try VoucherVision.')
|
1302 |
+
st.write('2. Name your run --- If the same name already exist, VV will append the date to the run name.')
|
1303 |
+
st.write('3. Choose a LLM version --- Only LLMs with valid keys will appear in the dropdown list.')
|
1304 |
+
st.write('4. Select a prompt version --- Start with "Version 2". Custom Prompts will include ".yaml" in the name. You can build your own Custom Prompt in the Prompt Builder.')
|
1305 |
+
st.markdown('5. Upload images --- Up to ~100 images can be uploaded in the Hugging Face Spaces implementation. If you want to process more images at once (and have more control in general) then use the [GitHub version](https://github.com/Gene-Weaver/VoucherVision). If you pay for persistent storage for your HF Space, then you may be able to process more too.')
|
1306 |
+
st.write('6. LeafMachine2 collage --- If selected, LeafMachine2 will isolate all text from the image and create a label collage, which will be sent to the OCR algorithm instead of the full image. This improves OCR detection for small or finely written text.')
|
1307 |
+
st.write('7. OCR overlay images --- If selected, VoucherVision will overlay the OCR detections onto the input image. This is useful for debugging transcription errors to see if the OCR failed or if the LLM failed.')
|
1308 |
+
st.write('8. Start processing --- Wait for VoucherVision to finish.')
|
1309 |
+
st.write('9. Download results --- Click the "Download Results" button to save the VoucherVision output to your computer. ***Output files will disappear if you start a new run or restart the Space.***')
|
1310 |
+
st.write('8. Editing the LLM transcriptions --- Use the VoucherVisionEditor to revise and correct any mistakes or ommissions.')
|
1311 |
+
# st.subheader('Run Tests', help="")
|
1312 |
+
# st.write('We include a single image for testing. If you want to test all of the available prompts and LLMs on a different set of images, copy your images into `../VoucherVision/demo/demo_images`.')
|
1313 |
+
# if st.button("Test GPT",disabled=True):
|
1314 |
+
# progress_report.set_n_overall(TestOptionsGPT.get_length())
|
1315 |
+
# test_results, JSON_results = run_demo_tests_GPT(progress_report)
|
1316 |
+
# with col_test:
|
1317 |
+
# display_test_results(test_results, JSON_results, 'gpt')
|
1318 |
+
# st.balloons()
|
1319 |
+
|
1320 |
+
# if st.button("Test PaLM2",disabled=True):
|
1321 |
+
# progress_report.set_n_overall(TestOptionsPalm.get_length())
|
1322 |
+
# test_results, JSON_results = run_demo_tests_Palm(progress_report)
|
1323 |
+
# with col_test:
|
1324 |
+
# display_test_results(test_results, JSON_results, 'palm')
|
1325 |
+
# st.balloons()
|
1326 |
|
1327 |
with col_run_3:
|
1328 |
st.subheader('Available LLMs and APIs')
|
|
|
1346 |
st.write("---")
|
1347 |
st.header('Input Images')
|
1348 |
st.write('Upload a batch of images using the uploader below. These images will be store temporarily on this server. Each time you upload new images the ***previously uploaded images will be deleted***. You can also clear these cached images by pressing the "Clear Staged Images" button.')
|
1349 |
+
col_local_1, col_local_2 = st.columns([2,6])
|
1350 |
+
|
1351 |
+
st.write("---")
|
1352 |
+
st.header('LeafMachine2 Label Collage')
|
1353 |
+
col_cropped_1, col_cropped_2 = st.columns([4,4])
|
1354 |
|
1355 |
st.write("---")
|
1356 |
+
st.header('OCR Overlay Image')
|
1357 |
+
col_ocr_1, col_ocr_2 = st.columns([4,4])
|
1358 |
+
|
1359 |
|
1360 |
os.path.join(st.session_state.dir_home, )
|
1361 |
### Project
|
|
|
1447 |
['ruler', 'barcode','label', 'colorcard','map','envelope','photo','attached_item','weights',
|
1448 |
'leaf_whole', 'leaf_partial', 'leaflet', 'seed_fruit_one', 'seed_fruit_many', 'flower_one', 'flower_many', 'bud','specimen','roots','wood'],default=default_crops)
|
1449 |
|
|
|
|
|
|
|
|
|
1450 |
with col_cropped_2:
|
1451 |
ba = os.path.join(st.session_state.dir_home,'demo', 'ba','ba2.png')
|
1452 |
image = Image.open(ba)
|
1453 |
st.image(image, caption='LeafMachine2 Collage', output_format = "PNG")
|
1454 |
+
|
1455 |
+
with col_ocr_1:
|
1456 |
+
st.write('This will plot bounding boxes around all text that Google Vision was able to detect. If there are no boxes around text, then the OCR failed, so that missing text will not be seen by the LLM when it is creating the JSON object. The created image will be viewable in the VoucherVisionEditor.')
|
1457 |
+
st.session_state.config['leafmachine']['do_create_OCR_helper_image'] = st.checkbox("Create image showing an overlay of the OCR detections", st.session_state.config['leafmachine'].get('do_create_OCR_helper_image', False))
|
1458 |
+
|
1459 |
+
with col_ocr_2:
|
1460 |
+
ocr = os.path.join(st.session_state.dir_home,'demo', 'ba','ocr.png')
|
1461 |
+
image_ocr = Image.open(ocr)
|
1462 |
+
st.image(image_ocr, caption='OCR Overlay Images', output_format = "PNG")
|
1463 |
|
1464 |
def content_tab_component():
|
1465 |
st.header('Archival Components')
|
demo/ba/ocr.png
ADDED
Git LFS Details
|
demo/img/VoucherVision_Keys.PNG
ADDED
Git LFS Details
|