Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ 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="""
|
9 |
function imgSize(){
|
@@ -18,10 +18,21 @@ size_js="""
|
|
18 |
def process_files(file):
|
19 |
read_file = Image.open(file)
|
20 |
read_file.save("tmp.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
#print (file_name)
|
24 |
-
return ("tmp.png")
|
25 |
|
26 |
|
27 |
|
@@ -88,6 +99,6 @@ with gr.Blocks() as app:
|
|
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()
|
|
|
3 |
from bs4 import BeautifulSoup
|
4 |
from google_img_source_search import ReverseImageSearcher
|
5 |
from PIL import Image
|
6 |
+
import os
|
7 |
|
8 |
size_js="""
|
9 |
function imgSize(){
|
|
|
18 |
def process_files(file):
|
19 |
read_file = Image.open(file)
|
20 |
read_file.save("tmp.png")
|
21 |
+
action_input = "Passed"
|
22 |
+
try:
|
23 |
+
action_input=f"{file.name}"
|
24 |
+
print ("first")
|
25 |
+
except Exception as e:
|
26 |
+
print (e)
|
27 |
+
try:
|
28 |
+
action_input = "tmp.png"
|
29 |
+
print ("Second")
|
30 |
+
except Exception as e:
|
31 |
+
print (e)
|
32 |
+
print(os.path.abspath(action_input))
|
33 |
+
out = os.path.abspath(action_input)
|
34 |
|
35 |
+
return ("tmp.png",out)
|
|
|
|
|
36 |
|
37 |
|
38 |
|
|
|
99 |
with gr.Row():
|
100 |
|
101 |
html_out = gr.HTML("""""")
|
102 |
+
inp_im.change(process_files,inp_im,[out_file,inp_url])
|
103 |
go_btn.click(rev_im,inp_url,[html_out])
|
104 |
app.launch()
|