Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,23 +40,26 @@ def run_script(text: str):
|
|
| 40 |
#inp.send_keys("test")
|
| 41 |
######################
|
| 42 |
|
| 43 |
-
|
| 44 |
screenshot = driver.get_screenshot_as_png()
|
| 45 |
except WebDriverException as e:
|
| 46 |
-
return [Image.new('RGB', (1, 1)), e]
|
| 47 |
finally:
|
| 48 |
if driver:
|
| 49 |
driver.quit()
|
| 50 |
|
| 51 |
-
return [Image.open(BytesIO(screenshot)), 'operation success.']
|
| 52 |
else:
|
| 53 |
-
return [None, 'Please enter a valid URL of a website/host.']
|
| 54 |
|
| 55 |
with gr.Blocks() as app:
|
| 56 |
inp = gr.Textbox()
|
| 57 |
btn= gr.Button()
|
| 58 |
with gr.Row():
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
app.launch()
|
|
|
|
| 40 |
#inp.send_keys("test")
|
| 41 |
######################
|
| 42 |
|
| 43 |
+
cookies = driver.get_cookies()
|
| 44 |
screenshot = driver.get_screenshot_as_png()
|
| 45 |
except WebDriverException as e:
|
| 46 |
+
return [Image.new('RGB', (1, 1)), e, None]
|
| 47 |
finally:
|
| 48 |
if driver:
|
| 49 |
driver.quit()
|
| 50 |
|
| 51 |
+
return [Image.open(BytesIO(screenshot)), 'operation success.',cookies]
|
| 52 |
else:
|
| 53 |
+
return [None, 'Please enter a valid URL of a website/host.',None]
|
| 54 |
|
| 55 |
with gr.Blocks() as app:
|
| 56 |
inp = gr.Textbox()
|
| 57 |
btn= gr.Button()
|
| 58 |
with gr.Row():
|
| 59 |
+
with gr.Column():
|
| 60 |
+
outim = gr.Image()
|
| 61 |
+
with gr.Column():
|
| 62 |
+
outp = gr.Textbox()
|
| 63 |
+
cook = gr.JSON()
|
| 64 |
+
btn.click(run_script,inp,[outim,outp,cook])
|
| 65 |
app.launch()
|