shivangibithel commited on
Commit
bcde4c8
1 Parent(s): 90c5c7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -70,8 +70,6 @@ def T2Isearch(query,focussed_word, k=5):
70
 
71
  # Search for the nearest neighbors in the FAISS text index
72
  D, I = text_index.search(query_vector, k)
73
- print(D)
74
- print(I)
75
 
76
  # get rank of all classes wrt to query
77
  classes_all = []
@@ -81,7 +79,6 @@ def T2Isearch(query,focussed_word, k=5):
81
 
82
  for neighbor_y in neighbor_ys:
83
  classes = np.where(neighbor_y > 0.5)[0]
84
- print(classes)
85
  for _class in classes:
86
  class_freq[_class] += 1
87
 
@@ -94,15 +91,18 @@ def T2Isearch(query,focussed_word, k=5):
94
 
95
  lis = ['aeroplane', 'bicycle','bird','boat','bottle','bus','car','cat','chair','cow','diningtable','dog','horse','motorbike','person','pottedplant','sheep','sofa','train','tvmonitor']
96
  class_ = lis[ranked_classes_after_knn[0]-1]
97
- print(class_)
98
 
99
  # Map the image ids to the corresponding image URLs
 
100
  for i in range(len(image_list)):
101
- if class_list[i] == class_ :
 
102
  image_name = image_list[i]
103
  image_data = zip_file.open("pascal_raw/images/dataset/"+ image_name)
104
  image = Image.open(image_data)
105
  st.image(image, width=600)
 
106
 
107
  query = st.text_input("Enter your search query here:")
108
  focussed_word = st.text_input("Enter focussed word here")
 
70
 
71
  # Search for the nearest neighbors in the FAISS text index
72
  D, I = text_index.search(query_vector, k)
 
 
73
 
74
  # get rank of all classes wrt to query
75
  classes_all = []
 
79
 
80
  for neighbor_y in neighbor_ys:
81
  classes = np.where(neighbor_y > 0.5)[0]
 
82
  for _class in classes:
83
  class_freq[_class] += 1
84
 
 
91
 
92
  lis = ['aeroplane', 'bicycle','bird','boat','bottle','bus','car','cat','chair','cow','diningtable','dog','horse','motorbike','person','pottedplant','sheep','sofa','train','tvmonitor']
93
  class_ = lis[ranked_classes_after_knn[0]-1]
94
+
95
 
96
  # Map the image ids to the corresponding image URLs
97
+ count = 0
98
  for i in range(len(image_list)):
99
+ if class_list[i] == class_ :
100
+ count+=1
101
  image_name = image_list[i]
102
  image_data = zip_file.open("pascal_raw/images/dataset/"+ image_name)
103
  image = Image.open(image_data)
104
  st.image(image, width=600)
105
+ if count == 5: break
106
 
107
  query = st.text_input("Enter your search query here:")
108
  focussed_word = st.text_input("Enter focussed word here")