Dagobert42
commited on
Commit
·
9b720a1
1
Parent(s):
e8a5261
add on change callback to switch models
Browse files- app.py +3 -1
- resources.py +0 -3
app.py
CHANGED
@@ -34,7 +34,9 @@ annotated_text(annotate_sentence(txt, tokens))
|
|
34 |
st.write(annotate_sentence(txt, tokens))
|
35 |
|
36 |
st.write("Now try the augmented model. Hopefully it's a bit better :)")
|
37 |
-
|
|
|
|
|
38 |
|
39 |
st.write("Or load another sentence")
|
40 |
def refresh_example():
|
|
|
34 |
st.write(annotate_sentence(txt, tokens))
|
35 |
|
36 |
st.write("Now try the augmented model. Hopefully it's a bit better :)")
|
37 |
+
def refresh_model():
|
38 |
+
session_state.augment = not session_state.augment
|
39 |
+
st.toggle("augmentations on" if session_state.augment else "augmentations off", session_state.augment, on_change=refresh_model)
|
40 |
|
41 |
st.write("Or load another sentence")
|
42 |
def refresh_example():
|
resources.py
CHANGED
@@ -3,9 +3,6 @@ import torch
|
|
3 |
import streamlit as st
|
4 |
from random import shuffle
|
5 |
|
6 |
-
st.session_state.counter = 0
|
7 |
-
st.session_state.augment = False
|
8 |
-
|
9 |
@st.cache_data
|
10 |
def load_sentences():
|
11 |
with open("sentences.pt", 'rb') as f:
|
|
|
3 |
import streamlit as st
|
4 |
from random import shuffle
|
5 |
|
|
|
|
|
|
|
6 |
@st.cache_data
|
7 |
def load_sentences():
|
8 |
with open("sentences.pt", 'rb') as f:
|