Spaces:
Sleeping
Sleeping
| import requests | |
| import bs4 | |
| import gradio as gr | |
| from bs4 import BeautifulSoup | |
| def run_lora(prompt,site): | |
| page = requests.get("https://www.google.dz/search?q=site:" +site + " " +prompt) | |
| soup = BeautifulSoup(page.content) | |
| import re | |
| links = soup.findAll("a") | |
| mLink="" | |
| for link in soup.find_all("a",href=re.compile("(?<=/url\?q=)(htt.*://.*)")): | |
| print (re.split(":(?=http)",link["href"].replace("/url?q=",""))) | |
| 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>Open Translate</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") | |
| 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],outputs=[translated_textbox]) | |
| app.queue() | |
| app.launch() |