Spaces:
Running
Running
yizhangliu
commited on
Commit
•
ccdb134
1
Parent(s):
70c2a37
Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ def get_image_enhancer(scale = 2, device='cuda:0'):
|
|
92 |
return img_enhancer
|
93 |
|
94 |
image_enhancer = None
|
95 |
-
if sys.platform == 'linux':
|
96 |
image_enhancer = get_image_enhancer(scale = 1, device=device)
|
97 |
|
98 |
model = None
|
@@ -272,7 +272,7 @@ set_page_elements = """async() => {
|
|
272 |
|
273 |
}"""
|
274 |
|
275 |
-
image_blocks = gr.Blocks(css=css, title='
|
276 |
with image_blocks as demo:
|
277 |
with gr.Group(elem_id="group_1", visible=True) as group_1:
|
278 |
with gr.Box():
|
@@ -290,10 +290,10 @@ with image_blocks as demo:
|
|
290 |
<p>
|
291 |
Solemnly promise: this application will not collect any user information and image resources.
|
292 |
</p>
|
293 |
-
<p>
|
294 |
-
【郑重承诺:本应用不收集任何用户信息和图片资源。】
|
295 |
-
</p>
|
296 |
</div>
|
|
|
|
|
|
|
297 |
"""
|
298 |
)
|
299 |
|
@@ -302,16 +302,16 @@ with image_blocks as demo:
|
|
302 |
with gr.Row(elem_id="input-container"):
|
303 |
with gr.Column():
|
304 |
image_input = gr.Image(source='upload', elem_id="image_upload",tool='sketch', type=f'{image_type}',
|
305 |
-
label="Upload
|
306 |
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
307 |
with gr.Column(elem_id="erase-container"):
|
308 |
-
btn_erase = gr.Button(value = "Erase(
|
309 |
margin=True,
|
310 |
rounded=(True, True, True, True),
|
311 |
full_width=True,
|
312 |
).style(width=100)
|
313 |
with gr.Column(elem_id="enhancer-checkbox", visible=True if image_enhancer is not None else False):
|
314 |
-
enhancer_label = 'Enhanced image(processing is very slow, please check only for blurred images)
|
315 |
img_enhancer = gr.Checkbox(label=enhancer_label).style(width=150)
|
316 |
with gr.Row(elem_id="output-container"):
|
317 |
with gr.Column():
|
@@ -325,5 +325,5 @@ with image_blocks as demo:
|
|
325 |
share_button.click(None, [], [], _js=share_js)
|
326 |
|
327 |
begin_button.click(fn=None, inputs=[], outputs=[group_1, group_2], _js=set_page_elements)
|
328 |
-
|
329 |
-
image_blocks.launch()
|
|
|
92 |
return img_enhancer
|
93 |
|
94 |
image_enhancer = None
|
95 |
+
if sys.platform == 'linux' and 0==1:
|
96 |
image_enhancer = get_image_enhancer(scale = 1, device=device)
|
97 |
|
98 |
model = None
|
|
|
272 |
|
273 |
}"""
|
274 |
|
275 |
+
image_blocks = gr.Blocks(css=css, title='Image Cleaner')
|
276 |
with image_blocks as demo:
|
277 |
with gr.Group(elem_id="group_1", visible=True) as group_1:
|
278 |
with gr.Box():
|
|
|
290 |
<p>
|
291 |
Solemnly promise: this application will not collect any user information and image resources.
|
292 |
</p>
|
|
|
|
|
|
|
293 |
</div>
|
294 |
+
<div style='margin: 0 auto; text-align: center'>
|
295 |
+
The Lama model comes from <a href='https://github.com/Sanster/lama-cleaner' target=_blank>[Lama]</a>. Thanks!
|
296 |
+
</div>
|
297 |
"""
|
298 |
)
|
299 |
|
|
|
302 |
with gr.Row(elem_id="input-container"):
|
303 |
with gr.Column():
|
304 |
image_input = gr.Image(source='upload', elem_id="image_upload",tool='sketch', type=f'{image_type}',
|
305 |
+
label="Upload", show_label=False).style(mobile_collapse=False)
|
306 |
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
307 |
with gr.Column(elem_id="erase-container"):
|
308 |
+
btn_erase = gr.Button(value = "Erase(↓)",elem_id="erase_btn").style(
|
309 |
margin=True,
|
310 |
rounded=(True, True, True, True),
|
311 |
full_width=True,
|
312 |
).style(width=100)
|
313 |
with gr.Column(elem_id="enhancer-checkbox", visible=True if image_enhancer is not None else False):
|
314 |
+
enhancer_label = 'Enhanced image(processing is very slow, please check only for blurred images)'
|
315 |
img_enhancer = gr.Checkbox(label=enhancer_label).style(width=150)
|
316 |
with gr.Row(elem_id="output-container"):
|
317 |
with gr.Column():
|
|
|
325 |
share_button.click(None, [], [], _js=share_js)
|
326 |
|
327 |
begin_button.click(fn=None, inputs=[], outputs=[group_1, group_2], _js=set_page_elements)
|
328 |
+
|
329 |
+
image_blocks.launch()
|