Spaces:
Sleeping
Sleeping
Rahkakavee Baskaran commited on
Commit ·
69cd746
1
Parent(s): ea3bd45
update tensors and add text to prediction
Browse filesFiles changed (2)
- app.py+60-15
- corpus_embeddings.pt+2-2
1 unmodified line2345678145 unmodified lines1541551561571581591607 unmodified lines1681691701711721731741751761771781791803 unmodified lines18418518618718818919019119219319423 unmodified lines2182192202212222232242252268 unmodified lines2352362372382392402412422432442452462472482497 unmodified lines2572582592601 unmodified lineimport pandas as pdimport streamlit as stimport jsonfrom plotly import express as pxfrom safetensors import safe_openfrom semantic_search import predictfrom sentence_transformers import SentenceTransformer145 unmodified linesst.set_page_config(layout="wide")st.title("Musterdatenkatalog")st.markdown("""7 unmodified lines)st.markdown('<p class="font">This demo showcases the algorithm of Musterdatenkatalog (MDK) of the Bertelsmann Stiftung. The MDK is a taxonomy of Open Data in municipalities in Germany. It is intended to help municipalities in Germany, as well as data analysts and journalists, to get an overview of the topics and the extent to which cities have already published data sets.</p>',unsafe_allow_html=True,)st.markdown('<p class="font"> For more details checkout the <a href=https://www.bertelsmann-stiftung.de/de/unsere-projekte/smart-country/musterdatenkatalog> Musterdatenkatalog.</p>',unsafe_allow_html=True,)3 unmodified linescol2.metric("Themen", len(theme_counts))col3.metric("Bezeichnungen", len(labels_counts))st.title("Taxonomy")st.plotly_chart(fig)st.title("Predict a Dataset")st.markdown("""23 unmodified linescol1, col2 = st.columns([1.2, 1])with col2:st.subheader("Example Input Dataset Names")examples = ["Spielplätze","Berliner Weihnachtsmärkte 2022",8 unmodified lineswith col1:if "query" not in st.session_state:query = st.text_input("Enter dataset name",)if "query" in st.session_state and st.session_state.query in examples:query = st.text_input("Enter dataset name", value=st.session_state.query)if "query" in st.session_state and st.session_state.query not in examples:del st.session_state["query"]query = st.text_input("Enter dataset name")top_k = st.select_slider("Top Results", options=[1, 2, 3, 4, 5], value=1)7 unmodified linesif st.button("Predict"):for prediction in predictions:st.write(prediction)1 unmodified line234567145 unmodified lines1531541551561571581597 unmodified lines1671681691701711721731741751761771781791801811821831841851861871881891903 unmodified lines19419519619719819920020120220320420520620723 unmodified lines2312322332342352362372382392402412422432442452462472482492502512522538 unmodified lines2622632642652662672682692702712722732742752762772782792802812822832842852862872882897 unmodified lines2972982993003013023033043051 unmodified lineimport pandas as pdimport streamlit as stimport jsonfrom safetensors import safe_openfrom semantic_search import predictfrom sentence_transformers import SentenceTransformer145 unmodified linesst.set_page_config(layout="wide")st.title("Musterdatenkatalog (MDK)")st.markdown("""7 unmodified lines)st.markdown("""<style>.prediction {font-size:10px !important;}</style>""",unsafe_allow_html=True,)st.markdown('<p class="font">This demo showcases the algorithm of Musterdatenkatalog (MDK) of the Bertelsmann Stiftung. The MDK is a taxonomy of Open Data in municipalities in Germany. It is intended to help municipalities in Germany, as well as data analysts and journalists, to get an overview of the topics and the extent to which cities have already published data sets.</p>',unsafe_allow_html=True,)st.markdown('<p class="font"> For more details checkout the <a href=https://www.bertelsmann-stiftung.de/de/unsere-projekte/smart-country/musterdatenkatalog> Musterdatenkatalog </a>.</p>',unsafe_allow_html=True,)3 unmodified linescol2.metric("Themen", len(theme_counts))col3.metric("Bezeichnungen", len(labels_counts))st.header("Explore the MDK-Classifier")st.markdown('<p class="font"> This section allows you to predict a label from the MDK Taxonomy for a title of a dataset from municipalities. You can either enter your own dataset title or click on one of the examples. Checkout also <a href=https://www.govdata.de/> GOVDATA </a> for more dataset title examples. \\If you click on predict, the model will predict the most likely label for the dataset title. You can also change the number of labels that should be predicted. For example, if you change the Top Results to 3, the model will predict the 3 most likely labels for the dataset title in descending order. </p>',unsafe_allow_html=True,)st.markdown("""23 unmodified linescol1, col2 = st.columns([1.2, 1])st.markdown("""<style>.example {font-size:24px !important;}</style>""",unsafe_allow_html=True,)with col2:st.markdown('<p class="example">Example Titles of Datasets</p>',unsafe_allow_html=True,)examples = ["Spielplätze","Berliner Weihnachtsmärkte 2022",8 unmodified lineswith col1:tabs_font_css = """<style>div[class*="stTextInput"] label p {font-size: 2px;}</style>"""st.write(tabs_font_css, unsafe_allow_html=True)st.markdown('<p class="example">Enter a dataset title</p>',unsafe_allow_html=True,)if "query" not in st.session_state:query = st.text_input("")if "query" in st.session_state and st.session_state.query in examples:query = st.text_input("Enter a dataset title", value=st.session_state.query)if "query" in st.session_state and st.session_state.query not in examples:del st.session_state["query"]query = st.text_input("Enter a dataset title")top_k = st.select_slider("Top Results", options=[1, 2, 3, 4, 5], value=1)7 unmodified linesif st.button("Predict"):for prediction in predictions:st.markdown(f'<p class="font"> {prediction} <p>', unsafe_allow_html=True)st.header("Musterdatenkatalog Taxonomy")st.plotly_chart(fig)
123version https://git-lfs.github.com/spec/v1oid sha256:26b84a249335502cd14ad3ea5b7ce5523266b7e6dddfd5110ba6fdd5cd41828asize 746592123version https://git-lfs.github.com/spec/v1oid sha256:64143d425585aed670f2556432cb5c38d721a1902f75ffb8e57102e46ea00aafsize 743520
app.py+60-15
corpus_embeddings.pt+2-2