Spaces:
Running
on
A10G
Running
on
A10G
tastelikefeet
commited on
Commit
•
e4ab5ef
1
Parent(s):
8981749
demo v1.1.2: dark mode user-friendly, more English examples
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ def parse_args():
|
|
47 |
|
48 |
args = parse_args()
|
49 |
if load_model:
|
50 |
-
inference = pipeline('my-anytext-task', model='damo/cv_anytext_text_generation_editing', model_revision='v1.1.
|
51 |
|
52 |
|
53 |
def count_lines(prompt):
|
@@ -197,8 +197,8 @@ def process(mode, prompt, pos_radio, sort_radio, revise_pos, show_debug, draw_im
|
|
197 |
}
|
198 |
results, rtn_code, rtn_warning, debug_info = inference(input_data, mode=mode, **params)
|
199 |
if rtn_code >= 0:
|
200 |
-
|
201 |
-
|
202 |
if rtn_warning:
|
203 |
gr.Warning(rtn_warning)
|
204 |
else:
|
@@ -251,44 +251,49 @@ with block:
|
|
251 |
[<a href="https://github.com/tyxsspa/AnyText" style="color:blue; font-size:18px;">Code</a>] \
|
252 |
[<a href="https://modelscope.cn/models/damo/cv_anytext_text_generation_editing/summary" style="color:blue; font-size:18px;">ModelScope</a>]\
|
253 |
[<a href="https://huggingface.co/spaces/modelscope/AnyText" style="color:blue; font-size:18px;">HuggingFace</a>]\
|
254 |
-
version: 1.1.
|
255 |
with gr.Row(variant='compact'):
|
|
|
|
|
256 |
with gr.Column():
|
|
|
|
|
|
|
257 |
with gr.Accordion('🕹Instructions(说明)', open=False,):
|
258 |
with gr.Tabs():
|
259 |
with gr.Tab("English"):
|
260 |
-
gr.Markdown('<span style="color
|
261 |
-
gr.Markdown('<span style="color
|
262 |
gr.Markdown('<span style="color:gray;font-size:12px">Please note, before running examples, ensure the manual draw area is empty, otherwise may get wrong results. Additionally, different examples use \
|
263 |
different parameters (such as resolution, seed, etc.). When generate your own, please pay attention to the parameter changes, or refresh the page to restore the default parameters.</span>')
|
264 |
-
gr.Markdown('<span style="color
|
265 |
-
gr.Markdown('<span style="color
|
266 |
enclosed in double quotes. Then, manually draw the specified position for each text line to generate the image.</span>\
|
267 |
<span style="color:red;font-size:16px">The drawing of text positions is crucial to the quality of the resulting image</span>, \
|
268 |
-
<span style="color
|
269 |
as closely as possible to the length or width of the corresponding text line. If [Manual-draw] is inconvenient, you can try dragging rectangles [Manual-rect] or random positions [Auto-rand].</span>')
|
270 |
gr.Markdown('<span style="color:gray;font-size:12px">When generating multiple lines, each position is matched with the text line according to a certain rule. The [Sort Position] option is used to \
|
271 |
determine whether to prioritize sorting from top to bottom or from left to right. You can open the [Show Debug] option in the parameter settings to observe the text position and glyph image \
|
272 |
in the result. You can also select the [Revise Position] which uses the bounding box of the rendered text as the revised position. However, it is occasionally found that the creativity of the \
|
273 |
generated text is slightly lower using this method.</span>')
|
274 |
-
gr.Markdown('<span style="color
|
275 |
-
gr.Markdown('<span style="color
|
276 |
the new text to be modified in [Prompt], then generate the image.</span>')
|
277 |
gr.Markdown('<span style="color:gray;font-size:12px">The reference image can be of any resolution, but it will be internally processed with a limit that the longer side cannot exceed 768 pixels, and the \
|
278 |
width and height will both be scaled to multiples of 64.</span>')
|
279 |
with gr.Tab("简体中文"):
|
280 |
-
gr.Markdown('<span style="color
|
281 |
-
gr.Markdown('<span style="color
|
282 |
gr.Markdown('<span style="color:gray;font-size:12px">请注意,运行示例前确保手绘位置区域是空的,防止影响示例结果,另外不同示例使用不同的参数(如分辨率,种子数等),如果要自行生成时,请留意参数变化,或刷新页面恢复到默认参数。</span>')
|
283 |
-
gr.Markdown('<span style="color
|
284 |
-
gr.Markdown('<span style="color
|
285 |
<span style="color:red;font-size:16px">文字位置的绘制对成图质量很关键</span>, \
|
286 |
-
<span style="color
|
287 |
可以尝试拖框矩形(Manual-rect)或随机生成(Auto-rand)。</span>')
|
288 |
gr.Markdown('<span style="color:gray;font-size:12px">多行生成时,每个位置按照一定规则排序后与文字行做对应,Sort Position选项用于确定排序时优先从上到下还是从左到右。\
|
289 |
可以在参数设置中打开Show Debug选项,在结果图像中观察文字位置和字形图。也可以勾选Revise Position选项,这样会用渲染文字的外接矩形作为修正后的位置,不过偶尔发现这样生成的文字创造性略低。</span>')
|
290 |
-
gr.Markdown('<span style="color
|
291 |
-
gr.Markdown('<span style="color
|
292 |
gr.Markdown('<span style="color:gray;font-size:12px">参考图可以为任意分辨率,但内部处理时会限制长边不能超过768,并且宽高都被缩放为64的整数倍。</span>')
|
293 |
with gr.Accordion('🛠Parameters(参数)', open=False):
|
294 |
with gr.Row(variant='compact'):
|
@@ -357,34 +362,50 @@ with block:
|
|
357 |
|
358 |
def exp_gen_click():
|
359 |
return [gr.Slider(value=512), gr.Slider(value=512)] # all examples are 512x512, refresh draw_img
|
360 |
-
|
361 |
-
|
362 |
-
[
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
[
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
]
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
with gr.Tab("🎨Text Editing(文字编辑)") as mode_edit:
|
385 |
with gr.Row(variant='compact'):
|
386 |
ref_img = gr.Image(label='Ref(参考图)', source='upload')
|
387 |
-
ori_img = gr.Image(label='Ori(原图)')
|
388 |
|
389 |
def upload_ref(x):
|
390 |
return [gr.Image(type="numpy", brush_radius=100, tool='sketch'),
|
@@ -398,34 +419,44 @@ with block:
|
|
398 |
gr.Markdown("")
|
399 |
run_edit = gr.Button(value="Run(运行)!", scale=0.3, elem_classes='run')
|
400 |
gr.Markdown("")
|
401 |
-
gr.Examples
|
402 |
-
|
403 |
-
[
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
[
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
ips = [prompt, pos_radio, sort_radio, revise_pos, show_debug, draw_img, rect_img, ref_img, ori_img, img_count, ddim_steps, image_width, image_height, strength, cfg_scale, seed, eta, a_prompt, n_prompt, *(rect_cb_list+rect_xywh_list)]
|
423 |
run_gen.click(fn=process, inputs=[gr.State('gen')] + ips, outputs=[result_gallery, result_info])
|
424 |
run_edit.click(fn=process, inputs=[gr.State('edit')] + ips, outputs=[result_gallery, result_info])
|
425 |
|
|
|
426 |
block.launch(
|
427 |
-
|
428 |
-
|
429 |
root_path=f"/{os.getenv('GRADIO_PROXY_PATH')}" if os.getenv('GRADIO_PROXY_PATH') else ""
|
430 |
)
|
431 |
# block.launch(server_name='0.0.0.0')
|
|
|
47 |
|
48 |
args = parse_args()
|
49 |
if load_model:
|
50 |
+
inference = pipeline('my-anytext-task', model='damo/cv_anytext_text_generation_editing', model_revision='v1.1.2', use_fp16=not args.use_fp32, use_translator=not args.no_translator, font_path=args.font_path)
|
51 |
|
52 |
|
53 |
def count_lines(prompt):
|
|
|
197 |
}
|
198 |
results, rtn_code, rtn_warning, debug_info = inference(input_data, mode=mode, **params)
|
199 |
if rtn_code >= 0:
|
200 |
+
save_images(results, img_save_folder)
|
201 |
+
print(f'Done, result images are saved in: {img_save_folder}')
|
202 |
if rtn_warning:
|
203 |
gr.Warning(rtn_warning)
|
204 |
else:
|
|
|
251 |
[<a href="https://github.com/tyxsspa/AnyText" style="color:blue; font-size:18px;">Code</a>] \
|
252 |
[<a href="https://modelscope.cn/models/damo/cv_anytext_text_generation_editing/summary" style="color:blue; font-size:18px;">ModelScope</a>]\
|
253 |
[<a href="https://huggingface.co/spaces/modelscope/AnyText" style="color:blue; font-size:18px;">HuggingFace</a>]\
|
254 |
+
version: 1.1.2 </div>')
|
255 |
with gr.Row(variant='compact'):
|
256 |
+
with gr.Column() as left_part:
|
257 |
+
pass
|
258 |
with gr.Column():
|
259 |
+
result_gallery = gr.Gallery(label='Result(结果)', show_label=True, preview=True, columns=2, allow_preview=True, height=600)
|
260 |
+
result_info = gr.Markdown('', visible=False)
|
261 |
+
with left_part:
|
262 |
with gr.Accordion('🕹Instructions(说明)', open=False,):
|
263 |
with gr.Tabs():
|
264 |
with gr.Tab("English"):
|
265 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">Run Examples</span>')
|
266 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">AnyText has two modes: Text Generation and Text Editing, and we provides a variety of examples. Select one, click on [Run!] button to run.</span>')
|
267 |
gr.Markdown('<span style="color:gray;font-size:12px">Please note, before running examples, ensure the manual draw area is empty, otherwise may get wrong results. Additionally, different examples use \
|
268 |
different parameters (such as resolution, seed, etc.). When generate your own, please pay attention to the parameter changes, or refresh the page to restore the default parameters.</span>')
|
269 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">Text Generation</span>')
|
270 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">Enter the textual description (in Chinese or English) of the image you want to generate in [Prompt]. Each text line that needs to be generated should be \
|
271 |
enclosed in double quotes. Then, manually draw the specified position for each text line to generate the image.</span>\
|
272 |
<span style="color:red;font-size:16px">The drawing of text positions is crucial to the quality of the resulting image</span>, \
|
273 |
+
<span style="color:#575757;font-size:16px">please do not draw too casually or too small. The number of positions should match the number of text lines, and the size of each position should be matched \
|
274 |
as closely as possible to the length or width of the corresponding text line. If [Manual-draw] is inconvenient, you can try dragging rectangles [Manual-rect] or random positions [Auto-rand].</span>')
|
275 |
gr.Markdown('<span style="color:gray;font-size:12px">When generating multiple lines, each position is matched with the text line according to a certain rule. The [Sort Position] option is used to \
|
276 |
determine whether to prioritize sorting from top to bottom or from left to right. You can open the [Show Debug] option in the parameter settings to observe the text position and glyph image \
|
277 |
in the result. You can also select the [Revise Position] which uses the bounding box of the rendered text as the revised position. However, it is occasionally found that the creativity of the \
|
278 |
generated text is slightly lower using this method.</span>')
|
279 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">Text Editing</span>')
|
280 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">Please upload an image in [Ref] as a reference image, then adjust the brush size, and mark the area(s) to be edited. Input the textual description and \
|
281 |
the new text to be modified in [Prompt], then generate the image.</span>')
|
282 |
gr.Markdown('<span style="color:gray;font-size:12px">The reference image can be of any resolution, but it will be internally processed with a limit that the longer side cannot exceed 768 pixels, and the \
|
283 |
width and height will both be scaled to multiples of 64.</span>')
|
284 |
with gr.Tab("简体中文"):
|
285 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">运行示例</span>')
|
286 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">AnyText有两种运行模式:文字生成和文字编辑,每种模式下提供了丰富的示例,选择一个,点击[Run!]即可。</span>')
|
287 |
gr.Markdown('<span style="color:gray;font-size:12px">请注意,运行示例前确保手绘位置区域是空的,防止影响示例结果,另外不同示例使用不同的参数(如分辨率,种子数等),如果要自行生成时,请留意参数变化,或刷新页面恢复到默认参数。</span>')
|
288 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">文字生成</span>')
|
289 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">在Prompt中输入描述提示词(支持中英文),需要生成的每一行文字用双引号包裹,然后依次手绘指定每行文字的位置,生成图片。</span>\
|
290 |
<span style="color:red;font-size:16px">文字位置的绘制对成图质量很关键</span>, \
|
291 |
+
<span style="color:#575757;font-size:16px">请不要画的太随意或太小,位置的数量要与文字行数量一致,每个位置的尺寸要与对应的文字行的长短或宽高尽量匹配。如果手绘(Manual-draw)不方便,\
|
292 |
可以尝试拖框矩形(Manual-rect)或随机生成(Auto-rand)。</span>')
|
293 |
gr.Markdown('<span style="color:gray;font-size:12px">多行生成时,每个位置按照一定规则排序后与文字行做对应,Sort Position选项用于确定排序时优先从上到下还是从左到右。\
|
294 |
可以在参数设置中打开Show Debug选项,在结果图像中观察文字位置和字形图。也可以勾选Revise Position选项,这样会用渲染文字的外接矩形作为修正后的位置,不过偶尔发现这样生成的文字创造性略低。</span>')
|
295 |
+
gr.Markdown('<span style="color:#3B5998;font-size:20px">文字编辑</span>')
|
296 |
+
gr.Markdown('<span style="color:#575757;font-size:16px">请上传一张待编辑的图片作为参考图(Ref),然后调整笔触大小后,在参考图上涂抹要编辑的位置,在Prompt中输入描述提示词和要修改的文字内容,生成图片。</span>')
|
297 |
gr.Markdown('<span style="color:gray;font-size:12px">参考图可以为任意分辨率,但内部处理时会限制长边不能超过768,并且宽高都被缩放为64的整数倍。</span>')
|
298 |
with gr.Accordion('🛠Parameters(参数)', open=False):
|
299 |
with gr.Row(variant='compact'):
|
|
|
362 |
|
363 |
def exp_gen_click():
|
364 |
return [gr.Slider(value=512), gr.Slider(value=512)] # all examples are 512x512, refresh draw_img
|
365 |
+
with gr.Tab("English Examples"):
|
366 |
+
exp_gen_en = gr.Examples(
|
367 |
+
[
|
368 |
+
['A raccoon stands in front of the blackboard with the words "Deep Learning" written on it', "example_images/gen17.png", "Manual-draw(手绘)", "↕", False, 4, 33789703],
|
369 |
+
['A crayon drawing by child, a snowman with a Santa hat, pine trees, outdoors in heavy snowfall, titled "Snowman"', "example_images/gen18.png", "Manual-draw(手绘)", "↕", False, 4, 35621187],
|
370 |
+
['A meticulously designed logo, a minimalist brain, stick drawing style, simplistic style, refined with minimal strokes, black and white color, white background, futuristic sense, exceptional design, logo name is "NextAI"', "example_images/gen19.png", "Manual-draw(手绘)", "↕", False, 4, 2563689],
|
371 |
+
['A photograph of the colorful graffiti art on the wall with the words "Hi~" "Get Ready" "to" "Party"', "example_images/gen21.png", "Manual-draw(手绘)", "↕", False, 4, 88952132],
|
372 |
+
['photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream', "example_images/gen9.png", "Manual-draw(手绘)", "↕", False, 4, 66273235],
|
373 |
+
['A fine sweater with knitted text: "Have" "A" "Good Day"', "example_images/gen20.png", "Manual-draw(手绘)", "↕", False, 4, 35107824],
|
374 |
+
['Sign on the clean building that reads "科学" and "과학" and "ステップ" and "SCIENCE"', "example_images/gen6.png", "Manual-draw(手绘)", "↕", True, 4, 13246309],
|
375 |
+
['A delicate square cake, cream and fruit, with "CHEERS" "to the" and "GRADUATE" written in chocolate', "example_images/gen8.png", "Manual-draw(手绘)", "↕", False, 4, 93424638],
|
376 |
+
['A nice drawing in pencil of Michael Jackson, with the words "Micheal" and "Jackson" written on it', "example_images/gen7.png", "Manual-draw(手绘)", "↕", False, 4, 83866922],
|
377 |
+
['a well crafted ice sculpture that made with "Happy" and "Holidays". Dslr photo, perfect illumination', "example_images/gen11.png", "Manual-draw(手绘)", "↕", True, 4, 64901362],
|
378 |
+
],
|
379 |
+
[prompt, draw_img, pos_radio, sort_radio, revise_pos, img_count, seed],
|
380 |
+
examples_per_page=5,
|
381 |
+
label=''
|
382 |
+
)
|
383 |
+
exp_gen_en.dataset.click(exp_gen_click, None, [image_width, image_height])
|
384 |
+
with gr.Tab("中文示例"):
|
385 |
+
exp_gen_ch = gr.Examples(
|
386 |
+
[
|
387 |
+
['一只浣熊站在黑板前,上面写着"深度学习"', "example_images/gen1.png", "Manual-draw(手绘)", "↕", False, 4, 81808278],
|
388 |
+
['一个儿童蜡笔画,森林里有一个可爱的蘑菇形状的房子,标题是"森林小屋"', "example_images/gen16.png", "Manual-draw(手绘)", "↕", False, 4, 40173333],
|
389 |
+
['一个精美设计的logo,画的是一个黑白风格的厨师,带着厨师帽,logo下方写着“深夜食堂”', "example_images/gen14.png", "Manual-draw(手绘)", "↕", False, 4, 6970544],
|
390 |
+
['一张户外雪地靴的电商广告,上面写着 “双12大促!”,“立减50”,“加绒加厚”,“穿脱方便”,“温暖24小时送达”, “包邮”,高级设计感,精美构图', "example_images/gen15.png", "Manual-draw(手绘)", "↕", False, 4, 66980376],
|
391 |
+
['一个精致的马克杯,上面雕刻着一首中国古诗,内容是 "花落知多少" "夜来风雨声" "处处闻啼鸟" "春眠不觉晓"', "example_images/gen3.png", "Manual-draw(手绘)", "↔", False, 4, 60358279],
|
392 |
+
['一件精美的毛衣,上面有针织的文字:"通义丹青"', "example_images/gen4.png", "Manual-draw(手绘)", "↕", False, 4, 48769450],
|
393 |
+
['一个双肩包的特写照,上面用针织文字写着”为了无法“ ”计算的价值“', "example_images/gen12.png", "Manual-draw(手绘)", "↕", False, 4, 35552323],
|
394 |
+
['一个漂亮的蜡笔画,有行星,宇航员,还有宇宙飞船,上面写的是"去火星旅行", "王小明", "11月1日"', "example_images/gen5.png", "Manual-draw(手绘)", "↕", False, 4, 42328250],
|
395 |
+
['一个装饰华丽的蛋糕,上面用奶油写着“阿里云”和"APSARA"', "example_images/gen13.png", "Manual-draw(手绘)", "↕", False, 4, 62357019],
|
396 |
+
['一张关于墙上的彩色涂鸦艺术的摄影作品,上面写着“人工智能" 和 "神经网络"', "example_images/gen10.png", "Manual-draw(手绘)", "↕", False, 4, 64722007],
|
397 |
+
['一枚中国古代铜钱, 上面的文字是 "康" "寶" "通" "熙"', "example_images/gen2.png", "Manual-draw(手绘)", "↕", False, 4, 24375031],
|
398 |
+
],
|
399 |
+
[prompt, draw_img, pos_radio, sort_radio, revise_pos, img_count, seed],
|
400 |
+
examples_per_page=5,
|
401 |
+
label=''
|
402 |
+
)
|
403 |
+
exp_gen_ch.dataset.click(exp_gen_click, None, [image_width, image_height])
|
404 |
|
405 |
with gr.Tab("🎨Text Editing(文字编辑)") as mode_edit:
|
406 |
with gr.Row(variant='compact'):
|
407 |
ref_img = gr.Image(label='Ref(参考图)', source='upload')
|
408 |
+
ori_img = gr.Image(label='Ori(原图)', scale=0.4)
|
409 |
|
410 |
def upload_ref(x):
|
411 |
return [gr.Image(type="numpy", brush_radius=100, tool='sketch'),
|
|
|
419 |
gr.Markdown("")
|
420 |
run_edit = gr.Button(value="Run(运行)!", scale=0.3, elem_classes='run')
|
421 |
gr.Markdown("")
|
422 |
+
with gr.Tab("English Examples"):
|
423 |
+
gr.Examples(
|
424 |
+
[
|
425 |
+
['A Minion meme that says "wrong"', "example_images/ref15.jpeg", "example_images/edit15.png", 4, 39934684],
|
426 |
+
['A pile of fruit with "UIT" written in the middle', "example_images/ref13.jpg", "example_images/edit13.png", 4, 54263567],
|
427 |
+
['Characters written in chalk on the blackboard that says "DADDY"', "example_images/ref8.jpg", "example_images/edit8.png", 4, 73556391],
|
428 |
+
['The blackboard says "Here"', "example_images/ref11.jpg", "example_images/edit11.png", 2, 15353513],
|
429 |
+
['A letter picture that says "THER"', "example_images/ref6.jpg", "example_images/edit6.png", 4, 72321415],
|
430 |
+
['A cake with colorful characters that reads "EVERYDAY"', "example_images/ref7.jpg", "example_images/edit7.png", 4, 8943410],
|
431 |
+
['photo of clean sandy beach," " " "', "example_images/ref16.jpeg", "example_images/edit16.png", 4, 85664100],
|
432 |
+
],
|
433 |
+
[prompt, ori_img, ref_img, img_count, seed],
|
434 |
+
examples_per_page=5,
|
435 |
+
label=''
|
436 |
+
)
|
437 |
+
with gr.Tab("中文示例"):
|
438 |
+
gr.Examples(
|
439 |
+
[
|
440 |
+
['精美的书法作品,上面写着“志” “存” “高” ”远“', "example_images/ref10.jpg", "example_images/edit10.png", 4, 98053044],
|
441 |
+
['一个表情包,小猪说 "下班"', "example_images/ref2.jpg", "example_images/edit2.png", 2, 43304008],
|
442 |
+
['一个中国古代铜钱,上面写着"乾" "隆"', "example_images/ref12.png", "example_images/edit12.png", 4, 89159482],
|
443 |
+
['一个漫画,上面写着" "', "example_images/ref14.png", "example_images/edit14.png", 4, 94081527],
|
444 |
+
['一个黄色标志牌,上边写着"不要" 和 "大意"', "example_images/ref3.jpg", "example_images/edit3.png", 2, 64010349],
|
445 |
+
['一个青铜鼎,上面写着" "和" "', "example_images/ref4.jpg", "example_images/edit4.png", 4, 71139289],
|
446 |
+
['一个建筑物前面的字母标牌, 上面写着 " "', "example_images/ref5.jpg", "example_images/edit5.png", 4, 50416289],
|
447 |
+
],
|
448 |
+
[prompt, ori_img, ref_img, img_count, seed],
|
449 |
+
examples_per_page=5,
|
450 |
+
label=''
|
451 |
+
)
|
452 |
ips = [prompt, pos_radio, sort_radio, revise_pos, show_debug, draw_img, rect_img, ref_img, ori_img, img_count, ddim_steps, image_width, image_height, strength, cfg_scale, seed, eta, a_prompt, n_prompt, *(rect_cb_list+rect_xywh_list)]
|
453 |
run_gen.click(fn=process, inputs=[gr.State('gen')] + ips, outputs=[result_gallery, result_info])
|
454 |
run_edit.click(fn=process, inputs=[gr.State('edit')] + ips, outputs=[result_gallery, result_info])
|
455 |
|
456 |
+
|
457 |
block.launch(
|
458 |
+
server_name='0.0.0.0' if os.getenv('GRADIO_LISTEN', '') != '' else "127.0.0.1",
|
459 |
+
share=False,
|
460 |
root_path=f"/{os.getenv('GRADIO_PROXY_PATH')}" if os.getenv('GRADIO_PROXY_PATH') else ""
|
461 |
)
|
462 |
# block.launch(server_name='0.0.0.0')
|