querysurvey1 / app.py
adpro's picture
Update app.py
c51e22b verified
raw
history blame
1.35 kB
import requests
import bs4
import gradio as gr
from bs4 import BeautifulSoup
from googlesearch import search
def run_lora(prompt,site,start,end):
# to search
query = "https://www.google.com/search?q=inurl:" +site + " " +prompt + "&tbs=cdr%3A1%2Ccd_min%3A"+start+"%2Ccd_max%3A" + end
links = []
for j in search(query, tld="co.in", num=10, stop=10, pause=2):
links.append(j)
return links
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()