Omnibus commited on
Commit
b17f522
1 Parent(s): cf7468e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -1,4 +1,18 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
 
4
  def first():
@@ -11,8 +25,6 @@ def test(inp):
11
  <head>
12
  </head>
13
  <body>
14
- <object data="{inp}"></object>
15
-
16
  <iframe
17
  src="{inp}"
18
  frameborder="0"
@@ -23,8 +35,14 @@ def test(inp):
23
  </html>'''
24
  return out
25
  with gr.Blocks() as app:
26
- input = gr.Textbox()
27
- btn = gr.Button()
 
 
 
 
28
  output = gr.HTML("""""")
 
 
29
  btn.click(first,None,output).then(test,input,output)
30
  app.launch()
 
1
  import gradio as gr
2
+ import requests
3
+ from BeautifulSoup import BeautifulSoup
4
+ import re
5
+
6
+ def search_fn(query):
7
+ page = requests.get(f"https://www.google.com/search?q={query}")
8
+ soup = BeautifulSoup(page.content)
9
+ links = soup.findAll("a")
10
+
11
+ links = soup.findAll("a")
12
+ for link in soup.find_all("a",href=re.compile("(?<=/url\?q=)(htt.*://.*)")):
13
+ out = (re.split(":(?=http)",link["href"].replace("/url?q=","")))
14
+ print (out)
15
+ #return out
16
 
17
 
18
  def first():
 
25
  <head>
26
  </head>
27
  <body>
 
 
28
  <iframe
29
  src="{inp}"
30
  frameborder="0"
 
35
  </html>'''
36
  return out
37
  with gr.Blocks() as app:
38
+ with gr.Row():
39
+ search_box=gr.Textbox("Search")
40
+ search_btn=gr.Button
41
+ with gr.Row():
42
+ input = gr.Textbox()
43
+ btn = gr.Button()
44
  output = gr.HTML("""""")
45
+
46
+ search_btn.click(search_fn,search_box,None)
47
  btn.click(first,None,output).then(test,input,output)
48
  app.launch()