shibing624 commited on
Commit
20bb905
1 Parent(s): fdd48fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -150,15 +150,18 @@ def main():
150
 
151
  if image is not None:
152
  q = [preprocess_image(image)]
 
153
  results = batch_search_index(q, model, faiss_index, df, 25, None, debug=False)[0]
154
  image_src = "data:image/jpeg;base64," + image_path_to_base64(image)
155
  html_output += f'Query: <img src="{image_src}" width="200" height="200"><br>'
156
  else:
157
  q = [text]
 
158
  results = batch_search_index(q, model, faiss_index, df, 25, None, debug=False)[0]
159
  html_output += f'Query: {text}<br>'
160
 
161
  html_output += f'Result Size: {len(results)}<br>'
 
162
  for result in results:
163
  item, similarity_score, _ = result
164
  item_dict = json.loads(item)
@@ -209,7 +212,7 @@ def main():
209
  outputs=output, show_progress=True)
210
  btn_submit.click(reset_user_input, outputs=[input_text, input_image])
211
 
212
- demo.queue().launch()
213
 
214
 
215
  if __name__ == '__main__':
 
150
 
151
  if image is not None:
152
  q = [preprocess_image(image)]
153
+ logger.debug(f"input image: {image}")
154
  results = batch_search_index(q, model, faiss_index, df, 25, None, debug=False)[0]
155
  image_src = "data:image/jpeg;base64," + image_path_to_base64(image)
156
  html_output += f'Query: <img src="{image_src}" width="200" height="200"><br>'
157
  else:
158
  q = [text]
159
+ logger.debug(f"input text: {text}")
160
  results = batch_search_index(q, model, faiss_index, df, 25, None, debug=False)[0]
161
  html_output += f'Query: {text}<br>'
162
 
163
  html_output += f'Result Size: {len(results)}<br>'
164
+ logger.debug(f"result size: {len(results)}")
165
  for result in results:
166
  item, similarity_score, _ = result
167
  item_dict = json.loads(item)
 
212
  outputs=output, show_progress=True)
213
  btn_submit.click(reset_user_input, outputs=[input_text, input_image])
214
 
215
+ demo.queue(concurrency_count=4, max_size=10, api_open=False).launch(show_api=False)
216
 
217
 
218
  if __name__ == '__main__':