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 |
uid=uuid.uuid4()
|
18 |
font_col=font_col.strip("#")
|
19 |
back_col=back_col.strip("#")
|
@@ -34,7 +34,7 @@ def run_script(html: str, style: str,font_col,back_col):
|
|
34 |
driver.get(url)
|
35 |
#html=driver.page_source
|
36 |
driver.implicitly_wait(30)
|
37 |
-
driver.set_window_size(
|
38 |
obj = driver.find_element(By.CLASS_NAME, "main")
|
39 |
#obj = driver.find_element(By.ID, "app-container")
|
40 |
#obj = driver.find_element(By.ID, "conversation-feed")
|
@@ -80,12 +80,12 @@ sty="""height:500;width:1000;"""
|
|
80 |
|
81 |
with gr.Blocks() as app:
|
82 |
with gr.Row():
|
83 |
-
inp = gr.Textbox(label="
|
84 |
with gr.Column():
|
85 |
style = gr.Textbox(label="CSS",lines=8,max_lines=50,value=sty)
|
86 |
with gr.Row():
|
87 |
-
|
88 |
-
|
89 |
btn= gr.Button()
|
90 |
with gr.Row():
|
91 |
with gr.Column():
|
@@ -94,5 +94,5 @@ with gr.Blocks() as app:
|
|
94 |
outp = gr.HTML()
|
95 |
cook = gr.Textbox(label="URL")
|
96 |
html=gr.Textbox(visible=False)
|
97 |
-
btn.click(run_script,[inp,style,
|
98 |
app.launch()
|
|
|
13 |
|
14 |
driver_type = 'chromedriver'
|
15 |
driver=False
|
16 |
+
def run_script(html: str, style: str,height,width):
|
17 |
uid=uuid.uuid4()
|
18 |
font_col=font_col.strip("#")
|
19 |
back_col=back_col.strip("#")
|
|
|
34 |
driver.get(url)
|
35 |
#html=driver.page_source
|
36 |
driver.implicitly_wait(30)
|
37 |
+
driver.set_window_size(int(width), int(height))
|
38 |
obj = driver.find_element(By.CLASS_NAME, "main")
|
39 |
#obj = driver.find_element(By.ID, "app-container")
|
40 |
#obj = driver.find_element(By.ID, "conversation-feed")
|
|
|
80 |
|
81 |
with gr.Blocks() as app:
|
82 |
with gr.Row():
|
83 |
+
inp = gr.Textbox(label="URL",lines=1,value=html)
|
84 |
with gr.Column():
|
85 |
style = gr.Textbox(label="CSS",lines=8,max_lines=50,value=sty)
|
86 |
with gr.Row():
|
87 |
+
height=gr.Number(label="Height", value=4096)
|
88 |
+
width=gr.Number(label="width",value=512)
|
89 |
btn= gr.Button()
|
90 |
with gr.Row():
|
91 |
with gr.Column():
|
|
|
94 |
outp = gr.HTML()
|
95 |
cook = gr.Textbox(label="URL")
|
96 |
html=gr.Textbox(visible=False)
|
97 |
+
btn.click(run_script,[inp,style,height,width],[outim,outp,cook,html])
|
98 |
app.launch()
|