Spaces:
Runtime error
Runtime error
Roland Szabo
commited on
Commit
·
c1d15c7
1
Parent(s):
d62f63f
Add explanation and spinners
Browse files
app.py
CHANGED
@@ -146,8 +146,16 @@ def get_book_type(idx):
|
|
146 |
return 'Short lettters'
|
147 |
return 'Revelation'
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
with st.form("my_form"):
|
150 |
-
st.write("Inside the form")
|
151 |
option1 = st.multiselect('Select Strongs numbers for first concept', all_defs.keys(),
|
152 |
['0025', '0026'], format_func=format_strong)
|
153 |
option2 = st.multiselect('Select Strongs numbers for second concept', all_defs.keys(),
|
@@ -157,9 +165,12 @@ with st.form("my_form"):
|
|
157 |
# Every form must have a submit button.
|
158 |
submitted = st.form_submit_button("Submit")
|
159 |
if submitted:
|
160 |
-
|
|
|
|
|
|
|
|
|
161 |
|
162 |
-
mapper = umap.UMAP().fit([x[0] for x in embeddings])
|
163 |
ts = mapper.embedding_
|
164 |
|
165 |
x = ts[:, 0]
|
|
|
146 |
return 'Short lettters'
|
147 |
return 'Revelation'
|
148 |
|
149 |
+
|
150 |
+
st.markdown("""
|
151 |
+
This app is a demo of using BERT to analyze the Greek New Testament. It allows you to compare two
|
152 |
+
clusters of Greek words (identified by their Strong's Numbers) and compare the embeddings for them.
|
153 |
+
|
154 |
+
To use it, select the words you want to use for the first cluster (eg. G0025 and G0026, which are
|
155 |
+
forms of agape), then select the words you want to use for the second cluster (eg. G5368, G5360,
|
156 |
+
G5363, which are forms of phileo) and then hit Submit.
|
157 |
+
""")
|
158 |
with st.form("my_form"):
|
|
|
159 |
option1 = st.multiselect('Select Strongs numbers for first concept', all_defs.keys(),
|
160 |
['0025', '0026'], format_func=format_strong)
|
161 |
option2 = st.multiselect('Select Strongs numbers for second concept', all_defs.keys(),
|
|
|
165 |
# Every form must have a submit button.
|
166 |
submitted = st.form_submit_button("Submit")
|
167 |
if submitted:
|
168 |
+
with st.spinner('Calculating embeddings...'):
|
169 |
+
embeddings = get_all_embeddings({"concept1": option1, "concept2": option2})
|
170 |
+
|
171 |
+
with st.spinner('Reducing dimensionality...'):
|
172 |
+
mapper = umap.UMAP().fit([x[0] for x in embeddings])
|
173 |
|
|
|
174 |
ts = mapper.embedding_
|
175 |
|
176 |
x = ts[:, 0]
|