Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,7 +58,7 @@ $body
|
|
58 |
"""
|
59 |
|
60 |
|
61 |
-
def get_screenshot(chat,css_in):
|
62 |
print(chat)
|
63 |
html_body=""
|
64 |
for user,bot in chat:
|
@@ -70,7 +70,7 @@ def get_screenshot(chat,css_in):
|
|
70 |
#css = css
|
71 |
#hti.screenshot(html_str=html, save_as='red_page.png')
|
72 |
#hti.screenshot(html_str=html_card, css_str=css, save_as='red_page.png')
|
73 |
-
|
74 |
hti.screenshot(html_str=html, css_str=css_in, save_as='red_page.png')
|
75 |
return 'red_page.png',html
|
76 |
|
@@ -133,7 +133,7 @@ with gr.Blocks(css=css) as app:
|
|
133 |
with gr.Column(scale=1):
|
134 |
with gr.Group():
|
135 |
with gr.Row():
|
136 |
-
im_height=gr.Number(label="Height",value=
|
137 |
im_width=gr.Number(label="Width",value=500)
|
138 |
wait_time=gr.Number(label="Wait Time",value=3000)
|
139 |
theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
|
@@ -144,7 +144,7 @@ with gr.Blocks(css=css) as app:
|
|
144 |
css_box=gr.Textbox(lines=50,value=css)
|
145 |
html_view=gr.HTML()
|
146 |
btn.click(chat_inf,[sys_inp,inp,chat_b],chat_b)
|
147 |
-
im_btn.click(get_screenshot,[chat_b,css_box],[img,html_view])
|
148 |
#im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
|
149 |
#app.load(get_screenshot,inp,img)
|
150 |
app.launch()
|
|
|
58 |
"""
|
59 |
|
60 |
|
61 |
+
def get_screenshot(chat,css_in,w,h):
|
62 |
print(chat)
|
63 |
html_body=""
|
64 |
for user,bot in chat:
|
|
|
70 |
#css = css
|
71 |
#hti.screenshot(html_str=html, save_as='red_page.png')
|
72 |
#hti.screenshot(html_str=html_card, css_str=css, save_as='red_page.png')
|
73 |
+
hti.size = (w, h)
|
74 |
hti.screenshot(html_str=html, css_str=css_in, save_as='red_page.png')
|
75 |
return 'red_page.png',html
|
76 |
|
|
|
133 |
with gr.Column(scale=1):
|
134 |
with gr.Group():
|
135 |
with gr.Row():
|
136 |
+
im_height=gr.Number(label="Height",value=500)
|
137 |
im_width=gr.Number(label="Width",value=500)
|
138 |
wait_time=gr.Number(label="Wait Time",value=3000)
|
139 |
theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
|
|
|
144 |
css_box=gr.Textbox(lines=50,value=css)
|
145 |
html_view=gr.HTML()
|
146 |
btn.click(chat_inf,[sys_inp,inp,chat_b],chat_b)
|
147 |
+
im_btn.click(get_screenshot,[chat_b,css_box,im_width,im_height],[img,html_view])
|
148 |
#im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
|
149 |
#app.load(get_screenshot,inp,img)
|
150 |
app.launch()
|