Alex Godelashvili commited on
Commit
55d889f
·
1 Parent(s): 442f811
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -156,9 +156,10 @@ def rerank_and_boost(query, df, I, rerank_scores, k=10):
156
 
157
 
158
  # --- Local method
159
- stopwords = ["хочу", "посмотреть", "смотреть", "нашел", "фильм", "покажи"]
 
160
 
161
- query = "смешная комедия про детектива с животными"
162
  query_cleaned = "query: " + "".join([word for word in query if word not in stopwords])
163
  query_vector = encoder.encode(query_cleaned, convert_to_numpy=True)
164
  query_vector = query_vector / np.linalg.norm(query_vector)
@@ -167,6 +168,17 @@ query_vector = query_vector.astype("float32").reshape(1, -1)
167
  # --- Search FAISS
168
  D, I = index.search(query_vector, k=10)
169
 
 
 
 
 
 
 
 
 
 
 
 
170
  col1, col2, col3 = st.columns(3)
171
 
172
  with col1:
@@ -197,7 +209,7 @@ with col3:
197
  title = df.iloc[idx]["title"]
198
  desc = df.iloc[idx]["description"]
199
  url = df.iloc[idx]["url"]
200
- print(f"{title} | {score} | {boost}")
201
- print(f"Description: {desc}")
202
- print(f"URL: {url}")
203
- print("")
 
156
 
157
 
158
  # --- Local method
159
+ # stopwords = ["хочу", "посмотреть", "смотреть", "нашел", "фильм", "покажи"]
160
+ stopwords = []
161
 
162
+ query = "хочу посмотреть фильм про кибер пиратов"
163
  query_cleaned = "query: " + "".join([word for word in query if word not in stopwords])
164
  query_vector = encoder.encode(query_cleaned, convert_to_numpy=True)
165
  query_vector = query_vector / np.linalg.norm(query_vector)
 
168
  # --- Search FAISS
169
  D, I = index.search(query_vector, k=10)
170
 
171
+
172
+ # ---
173
+ # ---
174
+ # ---
175
+ # ---
176
+ # ---
177
+
178
+
179
+ st.title(query)
180
+ st.divider()
181
+
182
  col1, col2, col3 = st.columns(3)
183
 
184
  with col1:
 
209
  title = df.iloc[idx]["title"]
210
  desc = df.iloc[idx]["description"]
211
  url = df.iloc[idx]["url"]
212
+ st.write(f"{title} | {score} | {boost}")
213
+ st.write(f"Description: {desc}")
214
+ st.write(f"URL: {url}")
215
+ st.write("")