sonoisa commited on
Commit
1e73bf4
โ€ข
1 Parent(s): a4cceba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -158,7 +158,7 @@ pyminizip.uncompress(
158
  df = pq.read_table("irasuto_items_20210224.parquet").to_pandas()
159
  sentence_vectors = np.stack(df["sentence_vector"])
160
 
161
- description_text.text("่ชฌๆ˜Žๆ–‡ใฎๆ„ๅ‘ณใŒ่ฟ‘ใ„ใ€Œใ„ใ‚‰ใ™ใจใ‚„ใ€็”ปๅƒใ‚’ๆคœ็ดขใ—ใพใ™ใ€‚")
162
 
163
  prev_query = ""
164
  query_input = st.text_input(label="่ชฌๆ˜Žๆ–‡", value="")
@@ -168,8 +168,8 @@ closest_n = st.number_input(label="ๆคœ็ดขๆ•ฐ", min_value=1, value=10, max_value=
168
  search_buttion = st.button("ๆคœ็ดข")
169
 
170
  if search_buttion or prev_query != query_input:
171
- query = query_input
172
- prev_query = query
173
  query_embedding = model.encode([query]).numpy()
174
 
175
  distances = scipy.spatial.distance.cdist(
 
158
  df = pq.read_table("irasuto_items_20210224.parquet").to_pandas()
159
  sentence_vectors = np.stack(df["sentence_vector"])
160
 
161
+ description_text.text("่ชฌๆ˜Žๆ–‡ใฎๆ„ๅ‘ณใŒ่ฟ‘ใ„ใ€Œใ„ใ‚‰ใ™ใจใ‚„ใ€็”ปๅƒใ‚’ๆคœ็ดขใ—ใพใ™ใ€‚\nใ‚ญใƒผใƒฏใƒผใƒ‰ใ‚’ๅˆ—ๆŒ™ใ™ใ‚‹ใ‚ˆใ‚Šใ‚‚ใ€่‡ช็„ถใชๆ–‡็ซ ใ‚’ๅ…ฅๅŠ›ใ—ใŸๆ–นใŒ็ฒพๅบฆใ‚ˆใๆคœ็ดขใงใใพใ™ใ€‚")
162
 
163
  prev_query = ""
164
  query_input = st.text_input(label="่ชฌๆ˜Žๆ–‡", value="")
 
168
  search_buttion = st.button("ๆคœ็ดข")
169
 
170
  if search_buttion or prev_query != query_input:
171
+ query = normalize_text(query_input)
172
+ prev_query = query_input
173
  query_embedding = model.encode([query]).numpy()
174
 
175
  distances = scipy.spatial.distance.cdist(