Omnibus commited on
Commit
c93723f
·
verified ·
1 Parent(s): a415e00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -10,10 +10,20 @@ from selenium.common.exceptions import WebDriverException
10
  from selenium.webdriver.common.keys import Keys
11
  from selenium.webdriver.common.by import By
12
  #from selenium_webdriver import WebElement
 
 
13
 
14
  driver_type = 'chromedriver'
15
  driver=False
16
 
 
 
 
 
 
 
 
 
17
  def get_concat_h_cut(in1, in2):
18
  im1=Image.open(in1)
19
  im2=Image.open(in2)
@@ -117,6 +127,6 @@ with gr.Blocks() as app:
117
  out=gr.Image()
118
  outgal=gr.Gallery()
119
  outim = gr.Image()
120
-
121
- btn.click(run_script,[inp,height,width,check_b,check_h],[outim,message,outgal,out])
122
  app.queue(default_concurrency_limit=5).launch()
 
10
  from selenium.webdriver.common.keys import Keys
11
  from selenium.webdriver.common.by import By
12
  #from selenium_webdriver import WebElement
13
+ from html2image import Html2Image
14
+ hti = Html2Image()
15
 
16
  driver_type = 'chromedriver'
17
  driver=False
18
 
19
+
20
+ def html2image():
21
+
22
+ html = """<h1> An interesting title </h1> This page will be red"""
23
+ css = "body {background: red;}"
24
+ hti.screenshot(html_str=html, css_str=css, save_as='red_page.png')
25
+ return 'red_page.png'
26
+
27
  def get_concat_h_cut(in1, in2):
28
  im1=Image.open(in1)
29
  im2=Image.open(in2)
 
127
  out=gr.Image()
128
  outgal=gr.Gallery()
129
  outim = gr.Image()
130
+ btn.click(html2image,None,out)
131
+ #btn.click(run_script,[inp,height,width,check_b,check_h],[outim,message,outgal,out])
132
  app.queue(default_concurrency_limit=5).launch()