Spaces:
Paused
Paused
gordonchan
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import os
|
|
11 |
|
12 |
|
13 |
|
14 |
-
|
15 |
SCRIPT_DIR = os.path.dirname(__file__) #适配获取exe解压后临时目录的路径
|
16 |
os.chdir(SCRIPT_DIR)
|
17 |
HY_HUMAN_MATTING_WEIGHTS_PATH = 'hivision_modnet.onnx'
|
@@ -22,10 +22,6 @@ size_list_dict = {"一寸": (413, 295), "二寸": (626, 413),
|
|
22 |
color_list_dict = {"蓝色": (86, 140, 212), "白色": (255, 255, 255), "红色": (233, 51, 35)}
|
23 |
|
24 |
|
25 |
-
# 设置Gradio examples
|
26 |
-
def set_example_image(example: list) -> dict:
|
27 |
-
return gr.ImageEditor(value=example[0])
|
28 |
-
|
29 |
|
30 |
# 检测RGB是否超出范围,如果超出则约束到0~255之间
|
31 |
def range_check(value, min_value=0, max_value=255):
|
@@ -150,7 +146,7 @@ if __name__ == "__main__":
|
|
150 |
render = ["纯色", "上下渐变(白)", "中心渐变(白)"]
|
151 |
|
152 |
title = "<h1 id='title'>HivisionIDPhotos</h1>"
|
153 |
-
description = "<h3>😎
|
154 |
css = '''
|
155 |
h1#title, h3 {
|
156 |
text-align: center;
|
@@ -184,9 +180,12 @@ if __name__ == "__main__":
|
|
184 |
|
185 |
img_but = gr.Button('开始制作')
|
186 |
# 案例图片
|
187 |
-
example_images = gr.
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
190 |
|
191 |
with gr.Column():
|
192 |
notification = gr.Text(label="状态", visible=False)
|
@@ -222,6 +221,6 @@ if __name__ == "__main__":
|
|
222 |
custom_size_height, custom_size_wdith],
|
223 |
outputs=[img_output_standard, img_output_standard_hd, img_output_layout, notification],
|
224 |
queue=True)
|
225 |
-
|
226 |
|
227 |
demo.queue().launch(share=True,inbrowser=True,allowed_paths=['./'])
|
|
|
11 |
|
12 |
|
13 |
|
14 |
+
|
15 |
SCRIPT_DIR = os.path.dirname(__file__) #适配获取exe解压后临时目录的路径
|
16 |
os.chdir(SCRIPT_DIR)
|
17 |
HY_HUMAN_MATTING_WEIGHTS_PATH = 'hivision_modnet.onnx'
|
|
|
22 |
color_list_dict = {"蓝色": (86, 140, 212), "白色": (255, 255, 255), "红色": (233, 51, 35)}
|
23 |
|
24 |
|
|
|
|
|
|
|
|
|
25 |
|
26 |
# 检测RGB是否超出范围,如果超出则约束到0~255之间
|
27 |
def range_check(value, min_value=0, max_value=255):
|
|
|
146 |
render = ["纯色", "上下渐变(白)", "中心渐变(白)"]
|
147 |
|
148 |
title = "<h1 id='title'>HivisionIDPhotos</h1>"
|
149 |
+
description = "<h3>😎demo只简单适配现有版本gradio</h3>"
|
150 |
css = '''
|
151 |
h1#title, h3 {
|
152 |
text-align: center;
|
|
|
180 |
|
181 |
img_but = gr.Button('开始制作')
|
182 |
# 案例图片
|
183 |
+
example_images = gr.Examples(
|
184 |
+
[
|
185 |
+
[path.as_posix()]
|
186 |
+
for path in sorted(pathlib.Path('images').rglob('*.jpg'))
|
187 |
+
],
|
188 |
+
inputs=img_input)
|
189 |
|
190 |
with gr.Column():
|
191 |
notification = gr.Text(label="状态", visible=False)
|
|
|
221 |
custom_size_height, custom_size_wdith],
|
222 |
outputs=[img_output_standard, img_output_standard_hd, img_output_layout, notification],
|
223 |
queue=True)
|
224 |
+
|
225 |
|
226 |
demo.queue().launch(share=True,inbrowser=True,allowed_paths=['./'])
|