Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -166,12 +166,17 @@ sentence_vectors = st.session_state.sentence_vectors
|
|
166 |
description_text.text("่ชฌๆๆใฎๆๅณใ่ฟใใใใใใจใใ็ปๅใๆค็ดขใใพใใ\nใญใผใฏใผใใๅๆใใใใใใ่ช็ถใชๆ็ซ ใๅ
ฅๅใใๆนใ็ฒพๅบฆใใๆค็ดขใงใใพใใ")
|
167 |
|
168 |
prev_query = ""
|
169 |
-
query_input = st.text_input(label="่ชฌๆๆ", value="")
|
170 |
|
171 |
closest_n = st.number_input(label="ๆค็ดขๆฐ", min_value=1, value=10, max_value=100)
|
172 |
|
173 |
search_buttion = st.button("ๆค็ดข")
|
174 |
|
|
|
|
|
|
|
|
|
|
|
175 |
if search_buttion or prev_query != query_input:
|
176 |
query = normalize_text(query_input)
|
177 |
prev_query = query_input
|
@@ -190,4 +195,4 @@ if search_buttion or prev_query != query_input:
|
|
190 |
for img_url in df.iloc[idx]["images"]:
|
191 |
md_content += f'<a href="{page_url}" target="_blank" rel="noopener noreferrer"><img src="{img_url}" width="100"></a>'
|
192 |
md_content += f'\n[{distance / 2:.4f}: {df.iloc[idx]["description"]}]({page_url})'
|
193 |
-
|
|
|
166 |
description_text.text("่ชฌๆๆใฎๆๅณใ่ฟใใใใใใจใใ็ปๅใๆค็ดขใใพใใ\nใญใผใฏใผใใๅๆใใใใใใ่ช็ถใชๆ็ซ ใๅ
ฅๅใใๆนใ็ฒพๅบฆใใๆค็ดขใงใใพใใ")
|
167 |
|
168 |
prev_query = ""
|
169 |
+
query_input = st.text_input(label="่ชฌๆๆ", value="", on_change=clear_result)
|
170 |
|
171 |
closest_n = st.number_input(label="ๆค็ดขๆฐ", min_value=1, value=10, max_value=100)
|
172 |
|
173 |
search_buttion = st.button("ๆค็ดข")
|
174 |
|
175 |
+
result_text = st.empty()
|
176 |
+
|
177 |
+
def clear_result():
|
178 |
+
result_text.text("")
|
179 |
+
|
180 |
if search_buttion or prev_query != query_input:
|
181 |
query = normalize_text(query_input)
|
182 |
prev_query = query_input
|
|
|
195 |
for img_url in df.iloc[idx]["images"]:
|
196 |
md_content += f'<a href="{page_url}" target="_blank" rel="noopener noreferrer"><img src="{img_url}" width="100"></a>'
|
197 |
md_content += f'\n[{distance / 2:.4f}: {df.iloc[idx]["description"]}]({page_url})'
|
198 |
+
result_text.markdown(md_content, unsafe_allow_html=True)
|