Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,8 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
from google_img_source_search import ReverseImageSearcher
|
5 |
-
from PIL import Image
|
|
|
6 |
import os
|
7 |
import uuid
|
8 |
uid=uuid.uuid4()
|
@@ -77,17 +78,23 @@ def find_it(inp):
|
|
77 |
#https://lens.google.com/uploadbyurl?url=
|
78 |
#https://tineye.com/search/?url=
|
79 |
#https://yandex.com/images/search?cbir_id=4330355%2FBhPd4CHqib3nxk9xOdS9pQ7899&rpt=imageview&url=
|
80 |
-
|
|
|
|
|
81 |
|
82 |
with gr.Blocks() as app:
|
83 |
with gr.Row():
|
84 |
with gr.Column():
|
85 |
inp_url=gr.Textbox(label="Image URL")
|
86 |
go_btn=gr.Button()
|
87 |
-
|
|
|
|
|
|
|
88 |
with gr.Row():
|
89 |
|
90 |
html_out = gr.HTML("""""")
|
|
|
91 |
inp_im.change(process_files,inp_im,[inp_url])
|
92 |
go_btn.click(rev_im,inp_url,[html_out])
|
93 |
app.launch()
|
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
from google_img_source_search import ReverseImageSearcher
|
5 |
+
from PIL import ImageGrab, Image
|
6 |
+
|
7 |
import os
|
8 |
import uuid
|
9 |
uid=uuid.uuid4()
|
|
|
78 |
#https://lens.google.com/uploadbyurl?url=
|
79 |
#https://tineye.com/search/?url=
|
80 |
#https://yandex.com/images/search?cbir_id=4330355%2FBhPd4CHqib3nxk9xOdS9pQ7899&rpt=imageview&url=
|
81 |
+
def p_clip():
|
82 |
+
img = ImageGrab.grabclipboard()
|
83 |
+
return img
|
84 |
|
85 |
with gr.Blocks() as app:
|
86 |
with gr.Row():
|
87 |
with gr.Column():
|
88 |
inp_url=gr.Textbox(label="Image URL")
|
89 |
go_btn=gr.Button()
|
90 |
+
|
91 |
+
with gr.Column():
|
92 |
+
inp_im=gr.Image(type='filepath')
|
93 |
+
paste_clip = gr.Button("Paste from Clipboard")
|
94 |
with gr.Row():
|
95 |
|
96 |
html_out = gr.HTML("""""")
|
97 |
+
paste_clip.click(p_clip,None,inp_im)
|
98 |
inp_im.change(process_files,inp_im,[inp_url])
|
99 |
go_btn.click(rev_im,inp_url,[html_out])
|
100 |
app.launch()
|