Bingsu commited on
Commit
d6511c1
1 Parent(s): e336559

fix: index error

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -33,5 +33,8 @@ result = semantic_search(text_emb, img_emb, top_k=6)[0]
33
  columns = st.columns(3) + st.columns(3)
34
  for i, col in enumerate(columns):
35
  photo_id = img_id[result[i]["corpus_id"]]
36
- img_url = info.loc[info["photo_id"] == photo_id, "photo_image_url"].values[0]
 
 
 
37
  col.image(img_url, use_column_width=True)
 
33
  columns = st.columns(3) + st.columns(3)
34
  for i, col in enumerate(columns):
35
  photo_id = img_id[result[i]["corpus_id"]]
36
+ target_series = info.loc[info["photo_id"] == photo_id, "photo_image_url"]
37
+ if len(target_series) == 0:
38
+ continue
39
+ img_url = target_series.iloc[0]
40
  col.image(img_url, use_column_width=True)