Omnibus commited on
Commit
283940a
1 Parent(s): 458c1fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -8,6 +8,7 @@ def rev_im(image_url):
8
  #image_url = 'https://i.pinimg.com/originals/c4/50/35/c450352ac6ea8645ead206721673e8fb.png'
9
  out_list = []
10
  out_im = []
 
11
  rev_img_searcher = ReverseImageSearcher()
12
  res = rev_img_searcher.search(image_url)
13
 
@@ -22,7 +23,15 @@ def rev_im(image_url):
22
  print(f'Title: {search_item.page_title}')
23
  print(f'Site: {search_item.page_url}')
24
  print(f'Img: {search_item.image_url}\n')
25
- return out_list,out_im
 
 
 
 
 
 
 
 
26
 
27
  def find_it(inp):
28
  out=""
@@ -61,7 +70,6 @@ with gr.Blocks() as app:
61
  inp_im=gr.Image()
62
  with gr.Row():
63
 
64
- outp_text = gr.Textbox(lines=4)
65
- outg = gr.Gallery()
66
- go_btn.click(rev_im,inp_url,[outp_text,outg])
67
  app.launch()
 
8
  #image_url = 'https://i.pinimg.com/originals/c4/50/35/c450352ac6ea8645ead206721673e8fb.png'
9
  out_list = []
10
  out_im = []
11
+ html_out = """"""
12
  rev_img_searcher = ReverseImageSearcher()
13
  res = rev_img_searcher.search(image_url)
14
 
 
23
  print(f'Title: {search_item.page_title}')
24
  print(f'Site: {search_item.page_url}')
25
  print(f'Img: {search_item.image_url}\n')
26
+ html_out = f"""{html_out}
27
+ <div>
28
+ Title: {search_item.page_title}<br>
29
+ Site: <a href='{search_item.page_url}'>{search_item.page_url}</a><br>
30
+ Img: <img src='{search_item.image_url}'<br>
31
+ </div>"""
32
+
33
+
34
+ return (gr.HTML(f'{html_out}')
35
 
36
  def find_it(inp):
37
  out=""
 
70
  inp_im=gr.Image()
71
  with gr.Row():
72
 
73
+ html_out = gr.HTML("")
74
+ go_btn.click(rev_im,inp_url,[html_out])
 
75
  app.launch()