Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
from google_img_source_search import ReverseImageSearcher
|
5 |
-
|
6 |
|
7 |
|
8 |
size_js="""
|
@@ -15,10 +15,13 @@ size_js="""
|
|
15 |
|
16 |
|
17 |
|
18 |
-
def process_files(
|
19 |
-
|
|
|
|
|
|
|
20 |
print (file_name)
|
21 |
-
return (
|
22 |
|
23 |
|
24 |
|
@@ -80,11 +83,11 @@ with gr.Blocks() as app:
|
|
80 |
with gr.Column():
|
81 |
inp_url=gr.Textbox(label="Image URL")
|
82 |
go_btn=gr.Button()
|
83 |
-
|
84 |
inp_im=gr.Image(type='filepath')
|
85 |
with gr.Row():
|
86 |
|
87 |
html_out = gr.HTML("""""")
|
88 |
-
inp_im.change(process_files,inp_im,
|
89 |
go_btn.click(rev_im,inp_url,[html_out])
|
90 |
app.launch()
|
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
from google_img_source_search import ReverseImageSearcher
|
5 |
+
from PIL import Image
|
6 |
|
7 |
|
8 |
size_js="""
|
|
|
15 |
|
16 |
|
17 |
|
18 |
+
def process_files(file):
|
19 |
+
read_file = Image.open(file)
|
20 |
+
read_file.save("tmp.png")
|
21 |
+
|
22 |
+
#file_name = files.name
|
23 |
print (file_name)
|
24 |
+
return ("tmp.png")
|
25 |
|
26 |
|
27 |
|
|
|
83 |
with gr.Column():
|
84 |
inp_url=gr.Textbox(label="Image URL")
|
85 |
go_btn=gr.Button()
|
86 |
+
out_file=gr.File()
|
87 |
inp_im=gr.Image(type='filepath')
|
88 |
with gr.Row():
|
89 |
|
90 |
html_out = gr.HTML("""""")
|
91 |
+
inp_im.change(process_files,inp_im,out_file)
|
92 |
go_btn.click(rev_im,inp_url,[html_out])
|
93 |
app.launch()
|