Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -100,7 +100,7 @@ def run_script1(url: str, height: int, width: int, check_b,check_h):
|
|
100 |
else:
|
101 |
return None, '<center>Please enter a valid URL of a website/host.',out_box,out
|
102 |
|
103 |
-
def run_script(url: str, height: int, width: int, check_b,check_h):
|
104 |
mes_box=[]
|
105 |
out_box=[]
|
106 |
uid=uuid.uuid4()
|
@@ -119,7 +119,7 @@ def run_script(url: str, height: int, width: int, check_b,check_h):
|
|
119 |
driver.get(url)
|
120 |
html=driver.page_source
|
121 |
print(html)
|
122 |
-
driver.implicitly_wait(
|
123 |
driver.set_window_size(int(width), int(height))
|
124 |
|
125 |
screenshot = driver.save_screenshot(f'{uid}-tmp.png')
|
@@ -150,7 +150,7 @@ with gr.Blocks() as app:
|
|
150 |
with gr.Column():
|
151 |
inp = gr.Textbox(label="URL (must be Public)",lines=1)
|
152 |
with gr.Row():
|
153 |
-
|
154 |
btn= gr.Button("Snapshot")
|
155 |
|
156 |
with gr.Column():
|
@@ -166,6 +166,6 @@ with gr.Blocks() as app:
|
|
166 |
outgal=gr.Gallery()
|
167 |
outim = gr.Image()
|
168 |
prev=gr.HTML()
|
169 |
-
load_btn.click(load_frame,inp,prev)
|
170 |
-
btn.click(run_script,[inp,height,width,check_b,check_h],[outim,message,outgal,out])
|
171 |
app.queue(default_concurrency_limit=5).launch()
|
|
|
100 |
else:
|
101 |
return None, '<center>Please enter a valid URL of a website/host.',out_box,out
|
102 |
|
103 |
+
def run_script(url: str, height: int, width: int, check_b,check_h,wait_time):
|
104 |
mes_box=[]
|
105 |
out_box=[]
|
106 |
uid=uuid.uuid4()
|
|
|
119 |
driver.get(url)
|
120 |
html=driver.page_source
|
121 |
print(html)
|
122 |
+
driver.implicitly_wait(wait_time)
|
123 |
driver.set_window_size(int(width), int(height))
|
124 |
|
125 |
screenshot = driver.save_screenshot(f'{uid}-tmp.png')
|
|
|
150 |
with gr.Column():
|
151 |
inp = gr.Textbox(label="URL (must be Public)",lines=1)
|
152 |
with gr.Row():
|
153 |
+
wait_time=gr.Slider(30, 1200, value=30, label="Wait time", info="Wait for page to load. More data = Longer wait"),
|
154 |
btn= gr.Button("Snapshot")
|
155 |
|
156 |
with gr.Column():
|
|
|
166 |
outgal=gr.Gallery()
|
167 |
outim = gr.Image()
|
168 |
prev=gr.HTML()
|
169 |
+
#load_btn.click(load_frame,inp,prev)
|
170 |
+
btn.click(run_script,[inp,height,width,check_b,check_h,wait_time],[outim,message,outgal,out])
|
171 |
app.queue(default_concurrency_limit=5).launch()
|