Spaces:
Sleeping
Sleeping
import streamlit as st | |
from gensim.models import KeyedVectors | |
st.title('Historical Word Embeddings') | |
st.write("Welcome!") | |
st.write("This is an interactive web app that allows users to explore how the meaning of words change over time. Use the sidebar on the left to navigate.") | |
st.write("Please wait while the data is loading:") | |
def load_data(): | |
models_all = { | |
1810: KeyedVectors.load('./data/vectors1810.kv'), | |
1840: KeyedVectors.load('./data/vectors1840.kv'), | |
1870: KeyedVectors.load('./data/vectors1870.kv'), | |
1900: KeyedVectors.load('./data/vectors1900.kv'), | |
1930: KeyedVectors.load('./data/vectors1930.kv'), | |
1960: KeyedVectors.load('./data/vectors1960.kv'), | |
1990: KeyedVectors.load('./data/vectors1990.kv') | |
} | |
return models_all | |
if 'models_all' not in st.session_state: | |
st.session_state['models_all'] = load_data() | |
st.write("Data loaded!") | |
st.write("Creator: Simon Walo") | |
st.write("Data source: https://nlp.stanford.edu/projects/histwords/ (SGNS All English (1800s-1990s))") | |