Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ from selenium.webdriver.common.by import By
|
|
| 13 |
|
| 14 |
driver_type = 'chromedriver'
|
| 15 |
driver=False
|
| 16 |
-
def run_script(html: str, style: str):
|
| 17 |
html = html.replace("\n","<br>")
|
| 18 |
#regex = r"^(https?://)"
|
| 19 |
#is_url = re.search(regex, text)
|
|
@@ -26,7 +26,7 @@ def run_script(html: str, style: str):
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
|
| 29 |
-
url = f"https://omnibus-txt2img-static.static.hf.space/index.html?format={style}&txt={html}"
|
| 30 |
driver = webdriver.Chrome(options=options)
|
| 31 |
driver.get(url)
|
| 32 |
#html=driver.page_source
|
|
@@ -65,19 +65,22 @@ def run_script(html: str, style: str):
|
|
| 65 |
return [None, 'Please enter a valid URL of a website/host.',None,None]
|
| 66 |
|
| 67 |
html="""<h1>This is the title</h1>
|
| 68 |
-
|
| 69 |
bla bla
|
| 70 |
• a bullet
|
| 71 |
• or two
|
| 72 |
-
|
| 73 |
|
| 74 |
-
sty="""
|
| 75 |
|
| 76 |
with gr.Blocks() as app:
|
| 77 |
with gr.Row():
|
| 78 |
-
inp = gr.Textbox(lines=8,max_lines=50,value=html)
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
btn= gr.Button()
|
| 82 |
with gr.Row():
|
| 83 |
with gr.Column():
|
|
@@ -86,5 +89,5 @@ with gr.Blocks() as app:
|
|
| 86 |
outp = gr.HTML()
|
| 87 |
cook = gr.Textbox()
|
| 88 |
html=gr.Textbox()
|
| 89 |
-
btn.click(run_script,[inp,style],[outim,outp,cook,html])
|
| 90 |
app.launch()
|
|
|
|
| 13 |
|
| 14 |
driver_type = 'chromedriver'
|
| 15 |
driver=False
|
| 16 |
+
def run_script(html: str, style: str,font_col,back_col):
|
| 17 |
html = html.replace("\n","<br>")
|
| 18 |
#regex = r"^(https?://)"
|
| 19 |
#is_url = re.search(regex, text)
|
|
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
|
| 29 |
+
url = f"https://omnibus-txt2img-static.static.hf.space/index.html?format=color:{font_col};background-color:{back_col};{style}&txt={html}"
|
| 30 |
driver = webdriver.Chrome(options=options)
|
| 31 |
driver.get(url)
|
| 32 |
#html=driver.page_source
|
|
|
|
| 65 |
return [None, 'Please enter a valid URL of a website/host.',None,None]
|
| 66 |
|
| 67 |
html="""<h1>This is the title</h1>
|
| 68 |
+
This is some information
|
| 69 |
bla bla
|
| 70 |
• a bullet
|
| 71 |
• or two
|
| 72 |
+
"""
|
| 73 |
|
| 74 |
+
sty="""height:500;width:1000;"""
|
| 75 |
|
| 76 |
with gr.Blocks() as app:
|
| 77 |
with gr.Row():
|
| 78 |
+
inp = gr.Textbox(label="HTML",lines=8,max_lines=50,value=html)
|
| 79 |
+
with gr.Column():
|
| 80 |
+
style = gr.Textbox(label="CSS",lines=8,max_lines=50,value=sty)
|
| 81 |
+
with gr.Row():
|
| 82 |
+
font_col=gr.ColorPicker("Font Color",value="Black")
|
| 83 |
+
back_col=gr.ColorPicker(label="Background Color",value="White")
|
| 84 |
btn= gr.Button()
|
| 85 |
with gr.Row():
|
| 86 |
with gr.Column():
|
|
|
|
| 89 |
outp = gr.HTML()
|
| 90 |
cook = gr.Textbox()
|
| 91 |
html=gr.Textbox()
|
| 92 |
+
btn.click(run_script,[inp,style,font_col,back_col],[outim,outp,cook,html])
|
| 93 |
app.launch()
|