alexandrecorreia commited on
Commit
a62d4b3
·
1 Parent(s): 9849e1c

New way of loading images into static folder for search

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -224,14 +224,8 @@ with gr.Blocks(theme=theme, title="New Look", css=css) as demo:
224
  file_name = f"{datetime.utcnow().strftime('%s')}.jpg"
225
  file_path = static_dir / file_name
226
  print(file_path)
227
- image_input.save("img_path.jpg")
228
- with open(file_path, "w") as f:
229
- f.write("""
230
- {% load static %}
231
- <img src="{% static 'img_path.jpg' %}" alt="My image">
232
- """)
233
- link = f'<a href="file={file_path}" target="_blank">{file_name}</a>'
234
- return link
235
 
236
  def search(text_input, image_input, image_path, text_relevance, image_relevance, best_seller_score_weight):
237
  if text_input == "" and image_input == None:
 
224
  file_name = f"{datetime.utcnow().strftime('%s')}.jpg"
225
  file_path = static_dir / file_name
226
  print(file_path)
227
+ image_input.save(file_path)
228
+ return file_path
 
 
 
 
 
 
229
 
230
  def search(text_input, image_input, image_path, text_relevance, image_relevance, best_seller_score_weight):
231
  if text_input == "" and image_input == None: