alexandrecorreia commited on
Commit
e122da3
·
1 Parent(s): 018d89a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -255,16 +255,19 @@ with gr.Blocks(theme=theme, title="New Look", css=css) as demo:
255
  gr.Markdown()
256
 
257
  def load(image_input):
258
- # file_name = f"{datetime.utcnow().strftime('%s')}.jpg"
259
- file_name = f"image_to_search.jpg"
260
- # file_path = static_dir / file_name
261
- file_path = "static/" + file_name
262
- print(file_path)
263
- image_input.save(file_path)
264
- return "https://minderalabs-newlook.hf.space/file=" + file_path
 
 
265
 
266
  def search(text_input, text_input_1, image_input, image_path, text_relevance, text_relevance_1, image_relevance, best_seller_score_weight):
267
- all_queries = [text_input, text_input_1, image_input]
 
268
  print(all_queries)
269
  all_queries_relevance = [text_relevance, text_relevance_1, image_relevance]
270
  print(all_queries_relevance)
 
255
  gr.Markdown()
256
 
257
  def load(image_input):
258
+ if image_input != None:
259
+ file_name = f"image_to_search.jpg"
260
+ # file_path = static_dir / file_name
261
+ file_path = "static/" + file_name
262
+ print(file_path)
263
+ image_input.save(file_path)
264
+ return "https://minderalabs-newlook.hf.space/file=" + file_path
265
+ else:
266
+ return ""
267
 
268
  def search(text_input, text_input_1, image_input, image_path, text_relevance, text_relevance_1, image_relevance, best_seller_score_weight):
269
+ # all_queries = [text_input, text_input_1, image_input]
270
+ all_queries = [text_input, text_input_1, image_path]
271
  print(all_queries)
272
  all_queries_relevance = [text_relevance, text_relevance_1, image_relevance]
273
  print(all_queries_relevance)