Spaces:
Runtime error
Commit
•
8b5ae1b
1
Parent(s):
083e357
fix: double rerun bug
Browse files- components/__pycache__/inspector.cpython-38.pyc +0 -0
- components/__pycache__/navigator.cpython-38.pyc +0 -0
- components/__pycache__/ranker.cpython-38.pyc +0 -0
- components/__pycache__/viewport.cpython-38.pyc +0 -0
- components/inspector.py +1 -1
- components/navigator.py +3 -1
- components/ranker.py +10 -1
- components/viewport.py +1 -1
- main.py +4 -2
components/__pycache__/inspector.cpython-38.pyc
CHANGED
Binary files a/components/__pycache__/inspector.cpython-38.pyc and b/components/__pycache__/inspector.cpython-38.pyc differ
|
components/__pycache__/navigator.cpython-38.pyc
CHANGED
Binary files a/components/__pycache__/navigator.cpython-38.pyc and b/components/__pycache__/navigator.cpython-38.pyc differ
|
components/__pycache__/ranker.cpython-38.pyc
CHANGED
Binary files a/components/__pycache__/ranker.cpython-38.pyc and b/components/__pycache__/ranker.cpython-38.pyc differ
|
components/__pycache__/viewport.cpython-38.pyc
CHANGED
Binary files a/components/__pycache__/viewport.cpython-38.pyc and b/components/__pycache__/viewport.cpython-38.pyc differ
|
components/inspector.py
CHANGED
@@ -30,7 +30,7 @@ def paint():
|
|
30 |
st.markdown('**modality**: ' + thought.modality)
|
31 |
st.markdown('**filename**: ' + thought.filename.split('/')[-1])
|
32 |
st.markdown('**timestamp**: ' + datetime.utcfromtimestamp(int(thought.timestamp)).strftime("%d.%m.%Y"))
|
33 |
-
st.markdown('**
|
34 |
else:
|
35 |
st.markdown('**type**: custom query')
|
36 |
if st.session_state['navigator_modality'] == 'language':
|
30 |
st.markdown('**modality**: ' + thought.modality)
|
31 |
st.markdown('**filename**: ' + thought.filename.split('/')[-1])
|
32 |
st.markdown('**timestamp**: ' + datetime.utcfromtimestamp(int(thought.timestamp)).strftime("%d.%m.%Y"))
|
33 |
+
st.markdown('**activation**: ' + str(round(np.log(thought.interest / (1 - 0.9)) - 0.9 * np.log((time.time() - thought.timestamp) / (3600 * 24) + 0.1), 2)))
|
34 |
else:
|
35 |
st.markdown('**type**: custom query')
|
36 |
if st.session_state['navigator_modality'] == 'language':
|
components/navigator.py
CHANGED
@@ -25,6 +25,7 @@ def load_imagery_shift():
|
|
25 |
|
26 |
|
27 |
def paint():
|
|
|
28 |
model = load_model()
|
29 |
modality = st.selectbox('modality', ['language', 'imagery'],
|
30 |
['language', 'imagery'].index(st.session_state.get('navigator_modality', 'language')))
|
@@ -55,5 +56,6 @@ def paint():
|
|
55 |
st.session_state['navigator_modality'] = modality
|
56 |
st.session_state['navigator_embedding'] = embedding
|
57 |
st.session_state['navigator_input'] = input
|
58 |
-
st.
|
|
|
59 |
|
25 |
|
26 |
|
27 |
def paint():
|
28 |
+
print('go')
|
29 |
model = load_model()
|
30 |
modality = st.selectbox('modality', ['language', 'imagery'],
|
31 |
['language', 'imagery'].index(st.session_state.get('navigator_modality', 'language')))
|
56 |
st.session_state['navigator_modality'] = modality
|
57 |
st.session_state['navigator_embedding'] = embedding
|
58 |
st.session_state['navigator_input'] = input
|
59 |
+
# print('last:', st.session_state['ranker_noise'])
|
60 |
+
# st.experimental_rerun()
|
61 |
|
components/ranker.py
CHANGED
@@ -8,4 +8,13 @@ def get_name():
|
|
8 |
def paint():
|
9 |
st.session_state['ranker_relatedness'] = st.slider('relatedness', -1., 1., 0.8, 0.01, help='the weight of semantic relatedness to the query')
|
10 |
st.session_state['ranker_activation'] = st.slider('activation', -1., 1., 0., 0.01, help='the weight of thought activation')
|
11 |
-
st.session_state['ranker_noise'] = st.slider('noise', 0., 0.1, 0.01, 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def paint():
|
9 |
st.session_state['ranker_relatedness'] = st.slider('relatedness', -1., 1., 0.8, 0.01, help='the weight of semantic relatedness to the query')
|
10 |
st.session_state['ranker_activation'] = st.slider('activation', -1., 1., 0., 0.01, help='the weight of thought activation')
|
11 |
+
st.session_state['ranker_noise'] = st.slider('noise', 0., 0.1, 0.01, 0.001, help='the amount of noise added')
|
12 |
+
|
13 |
+
# relatedness = st.slider('relatedness', -1., 1., 0.8, 0.01, help='the weight of semantic relatedness to the query')
|
14 |
+
# activation = st.slider('activation', -1., 1., 0., 0.01, help='the weight of thought activation')
|
15 |
+
# st.session_state['ranker_noise'] = st.slider('noise', 0., 0.1, 0.01, 0.001, help='the amount of noise added')
|
16 |
+
|
17 |
+
# if st.button('set'):
|
18 |
+
# st.session_state['ranker_relatedness'] = relatedness
|
19 |
+
# st.session_state['ranker_activation'] = activation
|
20 |
+
# st.session_state['ranker_noise'] = noise
|
components/viewport.py
CHANGED
@@ -26,6 +26,7 @@ def load_thoughts():
|
|
26 |
|
27 |
|
28 |
def paint(cols):
|
|
|
29 |
if st.session_state.get('navigator_embedding', None) is not None:
|
30 |
thoughts = load_thoughts()
|
31 |
results = util.semantic_search(
|
@@ -52,7 +53,6 @@ def paint(cols):
|
|
52 |
elif thought.modality == 'imagery':
|
53 |
st.image(thought.get_content())
|
54 |
|
55 |
-
key = np.random.random()
|
56 |
if st.button('jump', thought):
|
57 |
st.session_state['navigator_input'] = thought.get_content()
|
58 |
st.session_state['navigator_modality'] = thought.modality
|
26 |
|
27 |
|
28 |
def paint(cols):
|
29 |
+
# print('on viewport:', st.session_state['ranker_noise'])
|
30 |
if st.session_state.get('navigator_embedding', None) is not None:
|
31 |
thoughts = load_thoughts()
|
32 |
results = util.semantic_search(
|
53 |
elif thought.modality == 'imagery':
|
54 |
st.image(thought.get_content())
|
55 |
|
|
|
56 |
if st.button('jump', thought):
|
57 |
st.session_state['navigator_input'] = thought.get_content()
|
58 |
st.session_state['navigator_modality'] = thought.modality
|
main.py
CHANGED
@@ -15,14 +15,16 @@ cols = st.columns(6)
|
|
15 |
left_section = [navigator, ranker]
|
16 |
right_section = [inspector]
|
17 |
|
18 |
-
viewport.paint(cols[1:-1])
|
19 |
|
20 |
for component in left_section:
|
21 |
with cols[0]:
|
22 |
with st.expander(component.get_name(), True):
|
23 |
component.paint()
|
24 |
|
|
|
|
|
25 |
for component in right_section:
|
26 |
with cols[-1]:
|
27 |
with st.expander(component.get_name(), True):
|
28 |
-
component.paint()
|
|
15 |
left_section = [navigator, ranker]
|
16 |
right_section = [inspector]
|
17 |
|
|
|
18 |
|
19 |
for component in left_section:
|
20 |
with cols[0]:
|
21 |
with st.expander(component.get_name(), True):
|
22 |
component.paint()
|
23 |
|
24 |
+
viewport.paint(cols[1:-1])
|
25 |
+
|
26 |
for component in right_section:
|
27 |
with cols[-1]:
|
28 |
with st.expander(component.get_name(), True):
|
29 |
+
component.paint()
|
30 |
+
|