Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,10 +61,19 @@ def main():
|
|
| 61 |
Explore how different words and phrases relate to each other in the embedding space!
|
| 62 |
""")
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
# Sidebar
|
| 65 |
with st.sidebar:
|
| 66 |
st.header("Controls")
|
| 67 |
model_choice = st.selectbox("Choose a model:", ["BERT", "RoBERTa"])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
new_phrase = st.text_input("Enter a new word or phrase:", "")
|
| 70 |
if st.button("Add Phrase"):
|
|
|
|
| 61 |
Explore how different words and phrases relate to each other in the embedding space!
|
| 62 |
""")
|
| 63 |
|
| 64 |
+
# Load model at the beginning
|
| 65 |
+
model_choice = "BERT" # Default model
|
| 66 |
+
tokenizer, model = load_model(model_choice)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
# Sidebar
|
| 70 |
with st.sidebar:
|
| 71 |
st.header("Controls")
|
| 72 |
model_choice = st.selectbox("Choose a model:", ["BERT", "RoBERTa"])
|
| 73 |
+
|
| 74 |
+
if model_choice != st.session_state.get('last_model_choice'):
|
| 75 |
+
tokenizer, model = load_model(model_choice)
|
| 76 |
+
st.session_state.last_model_choice = model_choice
|
| 77 |
|
| 78 |
new_phrase = st.text_input("Enter a new word or phrase:", "")
|
| 79 |
if st.button("Add Phrase"):
|