Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,8 @@ import requests
|
|
| 3 |
from bs4 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 |
|
|
@@ -102,13 +102,14 @@ def format_t(inp):
|
|
| 102 |
return out
|
| 103 |
with gr.Blocks() as app:
|
| 104 |
with gr.Row():
|
| 105 |
-
search_box=gr.Textbox(label = "Search")
|
| 106 |
-
|
|
|
|
| 107 |
with gr.Row():
|
| 108 |
input = gr.Textbox(label = "URL")
|
| 109 |
btn = gr.Button()
|
| 110 |
output = gr.HTML("""""")
|
| 111 |
|
| 112 |
-
search_btn.click(search_fn,search_box,output)
|
| 113 |
btn.click(first,None,output).then(test,input,output)
|
| 114 |
app.launch()
|
|
|
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
import re
|
| 5 |
|
| 6 |
+
def search_fn(query,count):
|
| 7 |
+
page = requests.get(f"https://www.google.com/search?q={query}&num={count}")
|
| 8 |
soup = BeautifulSoup(page.content)
|
| 9 |
#links = soup.findAll("a")
|
| 10 |
|
|
|
|
| 102 |
return out
|
| 103 |
with gr.Blocks() as app:
|
| 104 |
with gr.Row():
|
| 105 |
+
search_box=gr.Textbox(label = "Search",scale=2)
|
| 106 |
+
num_return=gr.Number(value=20, scale=1)
|
| 107 |
+
search_btn=gr.Button(scale=2)
|
| 108 |
with gr.Row():
|
| 109 |
input = gr.Textbox(label = "URL")
|
| 110 |
btn = gr.Button()
|
| 111 |
output = gr.HTML("""""")
|
| 112 |
|
| 113 |
+
search_btn.click(search_fn,[search_box,num_return],output)
|
| 114 |
btn.click(first,None,output).then(test,input,output)
|
| 115 |
app.launch()
|