Spaces:
Sleeping
Sleeping
File size: 1,877 Bytes
7312ff0 6d102f7 0246891 7312ff0 c51e22b eceeeb7 0246891 c169589 155133d 61da87d d4030a2 1208102 d4030a2 1208102 cb2d17d 8691072 1208102 eceeeb7 7e0ed7b b481b5e 7e0ed7b af4b9a6 7e0ed7b 0246891 7e0ed7b 9c7a056 2997260 7e0ed7b 9c7a056 7e0ed7b c169589 0246891 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import requests
import bs4
import gradio as gr
from bs4 import BeautifulSoup
from googlesearch import search
import urllib.request
def run_lora(prompt,site,start,end):
# to search
page = requests.get("https://www.google.com/search?q=inurl:" +site + "+" +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
print("https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end)
soup = BeautifulSoup(page.content)
features="html.parser"
import re
links = soup.findAll("a")
mLink=""
#for link in soup.find_all("a", "html.parser", parse_only=SoupStrainer('a')):
for link in soup.find_all("a",href=re.compile("(?<=/url\?q=)(htt.*://.*)")):
print (re.split(":(?=http)",link["href"].replace("/url?q=","").replace("'","")))
mLink+=str(re.split(":(?=http)",link["href"].replace("/url?q=","").replace("'","")))
return mLink
with gr.Blocks() as app:
gr.HTML("""<html>
<head>
<style>
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Get survey</h1>
</body>
</html>""")
with gr.Row():
with gr.Column():
input_textbox = gr.Textbox(lines=5, placeholder="Enter key", label="Input Text")
input_sitebox = gr.Textbox(lines=5, placeholder="Enter site", label="Site Text")
start = gr.Textbox(lines=5, placeholder="Enter start", label="Enter start")
end = gr.Textbox(lines=5, placeholder="Enter End", label="Enter End")
with gr.Column():
translated_textbox = gr.Textbox(lines=5, placeholder="", label="Result Text")
info_label = gr.HTML("")
btn = gr.Button("GetNow")
btn.click(run_lora, inputs=[input_textbox,input_sitebox,start,end],outputs=[translated_textbox])
app.queue()
app.launch() |