Omnibus commited on
Commit
7716718
1 Parent(s): 2ff819d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,6 +1,20 @@
1
  import gradio as gr
2
  import requests
3
  from bs4 import BeautifulSoup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  def find_it(inp):
6
  out=""
@@ -37,5 +51,5 @@ with gr.Blocks() as app:
37
  go_btn=gr.Button()
38
  inp_im=gr.Image()
39
  outp_text = gr.Textbox(lines=4)
40
- go_btn.click(find_it,inp_url,outp_text)
41
  app.launch()
 
1
  import gradio as gr
2
  import requests
3
  from bs4 import BeautifulSoup
4
+ from google_img_source_search import ReverseImageSearcher
5
+
6
+
7
+ def rev_im(url):
8
+ image_url = 'https://i.pinimg.com/originals/c4/50/35/c450352ac6ea8645ead206721673e8fb.png'
9
+
10
+ rev_img_searcher = ReverseImageSearcher()
11
+ res = rev_img_searcher.search(image_url)
12
+
13
+ for search_item in res:
14
+ print(f'Title: {search_item.page_title}')
15
+ print(f'Site: {search_item.page_url}')
16
+ print(f'Img: {search_item.image_url}\n')
17
+ return search_item.image_url
18
 
19
  def find_it(inp):
20
  out=""
 
51
  go_btn=gr.Button()
52
  inp_im=gr.Image()
53
  outp_text = gr.Textbox(lines=4)
54
+ go_btn.click(rev_im,inp_url,outp_text)
55
  app.launch()