From 4e33a9762904b99774287bc233b7457ed6994efc Mon Sep 17 00:00:00 2001 From: akochari Date: Tue, 12 Nov 2024 18:35:24 +0100 Subject: [PATCH] add example image etc --- Dockerfile | 2 +- app/app.py | 7 ++++--- app/pages/01_SMILES_from_an_image_file.py | 8 ++++++++ app/test_predictions/example_structure_2.jpg | Bin 0 -> 9108 bytes 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 app/test_predictions/example_structure_2.jpg diff --git a/Dockerfile b/Dockerfile index 7e9e8ab..5704d7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,4 @@ EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health -ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] \ No newline at end of file +ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false"] \ No newline at end of file diff --git a/app/app.py b/app/app.py index f3b8c43..466d987 100644 --- a/app/app.py +++ b/app/app.py @@ -2,9 +2,10 @@ st.title("Predict SMILES encodings of chemical structure depictions in images") -intro = '''This application allows users to either [upload an image file](/SMILES_from_an_image_file) or [take a picture using their webcam](/SMILES_from_a_webcam_photo) -and get a prediction the chemical structure depicted in the image in SMILES notation. -The chemical structure depiction can be machine or hand drawn. +intro = '''This application allows users to either upload an image file or take a picture using their webcam +and get a prediction the chemical structure depicted in the image in SMILES notation. You can navigate using +__links in the sidebar to the left__. The chemical structure depiction can be machine or hand drawn. Note that +loading the pages or getting a prediction may sometimes take a while. This application is using the [DECIMER Image Transformer](https://github.com/Kohulan/DECIMER-Image_Transformer) (MIT license) model to make predictions (as implemented in the [DECIMER Python package](https://pypi.org/project/decimer/)). The DECIMER (Deep lEarning for Chemical ImagE Recognition) addresses the Optical Chemical Structure diff --git a/app/pages/01_SMILES_from_an_image_file.py b/app/pages/01_SMILES_from_an_image_file.py index 86dc0d1..c717569 100644 --- a/app/pages/01_SMILES_from_an_image_file.py +++ b/app/pages/01_SMILES_from_an_image_file.py @@ -13,6 +13,14 @@ st.write("The image files are only stored in RAM memory and are removed as soon as you close or reload the page.") +with open("./test_predictions/example_structure_2.jpg", "rb") as file: + btn = st.download_button( + label="Download an example image", + data=file, + file_name="example_structure.jpg", + mime="image/jpg", + ) + st.subheader("Step 1. Upload a file", divider="gray") # Input widget for users to upload image files from their computer diff --git a/app/test_predictions/example_structure_2.jpg b/app/test_predictions/example_structure_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f0ae798df11d948bfa7edc1e24e580ea24eae3e5 GIT binary patch literal 9108 zcmdUUXIN9))^1R+Y>HwCk!GQH1PO>pQRx_v5<*AmB-Bs>M8vX1ibUy36$BxP0Rsdi z5D*m*X+{XW38D8c{j$$@_P*P5PutJ){ke1fSYyocj(3bT*BtYibH96k7;w@+M_&iP z!~_5^9Xx>jKEQPV$1kkxtj9Un+1O8>;NavI26J<9aZ8^&&nv7btE_ZURzczNRWqH- zYDVe`3VM$EMi!QK_I8)FUAS7$iyjs_55uUh5cRt+u;L_oQF99 z8h|ampGW_Hud(q6`MCP6ig;Q`lZq=7y;d`;KaC*lUN+RnS`CRfqs5GY&okFFMef%f zF-nU5W*PDEEStAQ#oS0_fxoiHh1R>HC=TKV-@4Qo;r63^@}U14So3b)|i0 z+#OYb^sjxVbRk|EKKvpnDVQ&!_Sa&@^g#7uGBF}&Mk$?wLITseNXLN_l}2kd<(9pt zWZ%}mu^Y^T*}-d%`i5B*RLaHOmp1r8nhnq6hq`XlG@{@U)gLp*UFSL6yCgqPyb>xm zZI-d9h}nVe#PEtnYRy4hdwaHNRN$`$t80>eJIB4%#Bi5#ok?YS{aB|2iwYG1;L<*s$LjjZ(QDmFC&zmM?>jbi-tmW={5~M7 zW|#iR$Aw22^vzxkA9+5G-U6ha{Nlx-)!`l!SM$oKPUE@^xah zYgtwFcp2Omv1n9td-a}b!gKfJPZ!>o7)tS+60Mv^31Zr^X7>!R z!}QezBdNaZRbSC%e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