Spaces:
Runtime error
Runtime error
File size: 4,310 Bytes
61448a4 dc3cb2a 7ee7b26 fe5d243 61448a4 fe5d243 61448a4 7ee7b26 08fb6d9 7ee7b26 08fb6d9 7ee7b26 08fb6d9 7ee7b26 fe5d243 7ee7b26 08fb6d9 7ee7b26 08fb6d9 f58e4d2 fe5d243 f58e4d2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
from pathlib import Path
import streamlit as st
import streamlit.components.v1 as components
from PIL import Image
import base64
def read_markdown_file(markdown_file):
return Path(markdown_file).read_text()
def render_svg(svg_filename):
with open(svg_filename,"r") as f:
lines = f.readlines()
svg=''.join(lines)
"""Renders the given svg string."""
b64 = base64.b64encode(svg.encode('utf-8')).decode("utf-8")
html = r'<img src="data:image/svg+xml;base64,%s"/>' % b64
st.write(html, unsafe_allow_html=True)
def app():
st.markdown("# A visual-language foundation model for pathology")
st.markdown("This is a webapp for PLIP, our new fundational AI model for pathology and OpenPath our new dataset, **from our recent work**: Leveraging medical Twitter to build a visual-language foundation model for pathology")
st.markdown("### Pathology Language and Image Pretraining (PLIP)\n We develop PLIP, a multimodal AI with both image and text understanding. PLIP achieves state-of-the-art zero-shot and few-short performance for classifying new pathology images across diverse tasks. Moreover, PLIP enables users to retrieve similar cases by either image or natural language search, greatly facilitating knowledge sharing. Our approach demonstrates that publicly shared medical data is a tremendous opportunity that can be harnessed to advance biomedical AI.")
fig1e = Image.open('resources/4x/Fig1e.png')
st.image(fig1e, caption='PLIP training procedure', output_format='png')
st.markdown("### OpenPath Dataset\nThe lack of annotated publicly available medical images is a major barrier for innovations. At the same time, many de-identified images and much knowledge are shared by clinicians on public forums such as medical Twitter. Here we harness these crowd platforms to curate OpenPath, a large dataset of **208,414** pathology images paired with natural language descriptions")
render_svg("resources/SVG/Asset 49.svg")
st.markdown("### Documentation\n"
"This webapp comes with different functionalities.\n"
"* Details: The details page guides you through our work.\n"
"* Text to Image: allows users to perform text search on a database of images.\n"
"* Image to Image: allows users to perform image search on a database of images.\n"
"")
st.markdown("### Other Links\n"
"* Download OpenPath\n"
"* Code to reproduce [PLIP ](https://github.com/vinid/path_eval) results\n"
"* Link to the [PLIP Model](https://huggingface.co/vinid/plip)\n"
"")
st.markdown("""---""")
st.markdown('Disclaimer')
st.caption('Please be advised that this function has been developed in compliance with the Twitter policy of data usage and sharing. It is important to note that the results obtained from this function are not intended to constitute medical advice or replace consultation with a qualified medical professional. The use of this function is solely at your own risk and should be consistent with applicable laws, regulations, and ethical considerations. We do not warrant or guarantee the accuracy, completeness, suitability, or usefulness of this function for any particular purpose, and we hereby disclaim any liability arising from any reliance placed on this function or any results obtained from its use. If you wish to review the original Twitter post, you should access the source page directly on Twitter.')
st.markdown('Privacy statement')
st.caption('In accordance with the privacy and control policy of Twitter, we hereby declared that the data redistributed by us shall only comprise of Tweet IDs. The Tweet IDs will be employed to establish a linkage with the original Twitter post, as long as the original post is still accessible. The hyperlink will cease to function if the user deletes the original post. It is important to note that all tweets displayed on our service have already been classified as non-sensitive by Twitter. It is strictly prohibited to redistribute any content apart from the Tweet IDs. Any distribution carried out must adhere to the laws and regulations applicable in your jurisdiction, including export control laws and embargoes.')
|