Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ def search_fn(query,count):
|
|
49 |
out = format_t(html_out)
|
50 |
return out
|
51 |
def details_fn(query):
|
52 |
-
|
53 |
page = requests.get(f"{query}")
|
54 |
#links = soup.findAll("a")
|
55 |
soup = BeautifulSoup(page.content, 'html.parser')
|
@@ -90,6 +90,7 @@ def details_fn(query):
|
|
90 |
images = soup.findAll('img')
|
91 |
for img in images:
|
92 |
if not img['src'].startswith("data:"):
|
|
|
93 |
image_out += f"""
|
94 |
<div class='im_each'>
|
95 |
<img src={img['src']}>
|
@@ -100,7 +101,7 @@ def details_fn(query):
|
|
100 |
except Exception as e:
|
101 |
format_out = "None"
|
102 |
print (e)
|
103 |
-
return out,format_out
|
104 |
|
105 |
def first():
|
106 |
out = '''<h1>Loading'''
|
@@ -185,9 +186,9 @@ with gr.Blocks() as app:
|
|
185 |
output = gr.HTML("""""")
|
186 |
images = gr.HTML("""""")
|
187 |
with gr.Row() as im_row:
|
188 |
-
im_list = gr.
|
189 |
-
|
190 |
|
191 |
search_btn.click(search_fn,[search_box,num_return],output)
|
192 |
-
btn.click(first,None,output).then(test,input,output).then(details_fn,input,[details,images
|
193 |
app.launch()
|
|
|
49 |
out = format_t(html_out)
|
50 |
return out
|
51 |
def details_fn(query):
|
52 |
+
link_list=[]
|
53 |
page = requests.get(f"{query}")
|
54 |
#links = soup.findAll("a")
|
55 |
soup = BeautifulSoup(page.content, 'html.parser')
|
|
|
90 |
images = soup.findAll('img')
|
91 |
for img in images:
|
92 |
if not img['src'].startswith("data:"):
|
93 |
+
link_list.append(img['src'])
|
94 |
image_out += f"""
|
95 |
<div class='im_each'>
|
96 |
<img src={img['src']}>
|
|
|
101 |
except Exception as e:
|
102 |
format_out = "None"
|
103 |
print (e)
|
104 |
+
return out,format_out,link_list,link_list
|
105 |
|
106 |
def first():
|
107 |
out = '''<h1>Loading'''
|
|
|
186 |
output = gr.HTML("""""")
|
187 |
images = gr.HTML("""""")
|
188 |
with gr.Row() as im_row:
|
189 |
+
im_list = gr.Gallery()
|
190 |
+
link_list=gr.Textbox()
|
191 |
|
192 |
search_btn.click(search_fn,[search_box,num_return],output)
|
193 |
+
btn.click(first,None,output).then(test,input,output).then(details_fn,input,[details,images,im_list,link_list])
|
194 |
app.launch()
|