Spaces:
Sleeping
Sleeping
File size: 1,180 Bytes
7312ff0 6d102f7 0246891 7312ff0 0246891 2f0282a 0246891 d162e63 55cf7e5 2f0282a 7e0ed7b b481b5e 7e0ed7b 0246891 7e0ed7b 2f0282a 7e0ed7b 1b927e2 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 |
import requests
import bs4
import gradio as gr
from bs4 import BeautifulSoup
def run_lora(prompt):
page = requests.get("https://www.google.dz/search?q="+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=","")))
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 text to translate", label="Input Text")
with gr.Column():
translated_textbox = gr.Textbox(lines=5, placeholder="", label="Translated Text")
info_label = gr.HTML("")
btn = gr.Button("GetNow")
btn.click(run_lora, inputs=[input_textbox],outputs=[translated_textbox, info_label])
app.queue()
app.launch() |