Spaces:
Runtime error
Runtime error
artificialguybr
commited on
Commit
•
ddf5341
1
Parent(s):
80f9059
Update app.py
Browse files
app.py
CHANGED
@@ -55,43 +55,51 @@ with gr.Blocks() as app:
|
|
55 |
title = gr.Markdown("# artificialguybr LoRA portfolio")
|
56 |
description = gr.Markdown("### This is a Pixel Art Generator using SD Loras.")
|
57 |
selected_state = gr.State()
|
|
|
58 |
with gr.Row():
|
59 |
gallery = gr.Gallery([(item["image"], item["title"]) for item in loras], label="LoRA Gallery", allow_preview=False, columns=3)
|
|
|
60 |
with gr.Column():
|
61 |
prompt_title = gr.Markdown("### Click on a LoRA in the gallery to create with it")
|
62 |
selected_info = gr.Markdown("")
|
|
|
63 |
with gr.Row():
|
64 |
prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA")
|
65 |
button = gr.Button("Run")
|
|
|
66 |
result = gr.Image(interactive=False, label="Generated Image")
|
67 |
refined_result = gr.Image(interactive=False, label="Refined Generated Image")
|
68 |
post_processed_result = gr.Image(interactive=False, label="Post-Processed Image")
|
|
|
69 |
with gr.Tabs():
|
70 |
with gr.TabItem("Color"):
|
71 |
enable_color_limit = gr.Checkbox(label="Enable", value=False)
|
72 |
number_of_colors = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
|
|
|
73 |
with gr.TabItem("Grayscale"):
|
74 |
is_grayscale = gr.Checkbox(label="Enable", value=False)
|
75 |
number_of_shades = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
|
|
|
76 |
with gr.TabItem("Black and white"):
|
77 |
is_black_and_white = gr.Checkbox(label="Enable", value=False)
|
78 |
black_and_white_threshold = gr.Slider(label="Threshold", minimum=1, maximum=256, step=1, value=128)
|
|
|
79 |
with gr.TabItem("Custom color palette"):
|
80 |
use_color_palette = gr.Checkbox(label="Enable", value=False)
|
81 |
palette_image = gr.Image(label="Color palette image", type="pil")
|
82 |
palette_colors = gr.Slider(label="Palette Size (only for complex images)", minimum=1, maximum=256, step=1, value=16)
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
post_process_button = gr.Button("Apply Post-Processing")
|
91 |
-
|
92 |
gallery.select(update_selection, outputs=[prompt, selected_info, selected_state])
|
93 |
prompt.submit(fn=run_lora, inputs=[prompt, selected_state], outputs=[result, refined_result])
|
94 |
post_process_button.click(fn=apply_post_processing, inputs=[refined_result, downscale, limit_colors, grayscale, black_and_white], outputs=[post_processed_result])
|
95 |
-
|
96 |
app.queue(max_size=20, concurrency_count=5)
|
97 |
app.launch()
|
|
|
55 |
title = gr.Markdown("# artificialguybr LoRA portfolio")
|
56 |
description = gr.Markdown("### This is a Pixel Art Generator using SD Loras.")
|
57 |
selected_state = gr.State()
|
58 |
+
|
59 |
with gr.Row():
|
60 |
gallery = gr.Gallery([(item["image"], item["title"]) for item in loras], label="LoRA Gallery", allow_preview=False, columns=3)
|
61 |
+
|
62 |
with gr.Column():
|
63 |
prompt_title = gr.Markdown("### Click on a LoRA in the gallery to create with it")
|
64 |
selected_info = gr.Markdown("")
|
65 |
+
|
66 |
with gr.Row():
|
67 |
prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA")
|
68 |
button = gr.Button("Run")
|
69 |
+
|
70 |
result = gr.Image(interactive=False, label="Generated Image")
|
71 |
refined_result = gr.Image(interactive=False, label="Refined Generated Image")
|
72 |
post_processed_result = gr.Image(interactive=False, label="Post-Processed Image")
|
73 |
+
|
74 |
with gr.Tabs():
|
75 |
with gr.TabItem("Color"):
|
76 |
enable_color_limit = gr.Checkbox(label="Enable", value=False)
|
77 |
number_of_colors = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
|
78 |
+
|
79 |
with gr.TabItem("Grayscale"):
|
80 |
is_grayscale = gr.Checkbox(label="Enable", value=False)
|
81 |
number_of_shades = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
|
82 |
+
|
83 |
with gr.TabItem("Black and white"):
|
84 |
is_black_and_white = gr.Checkbox(label="Enable", value=False)
|
85 |
black_and_white_threshold = gr.Slider(label="Threshold", minimum=1, maximum=256, step=1, value=128)
|
86 |
+
|
87 |
with gr.TabItem("Custom color palette"):
|
88 |
use_color_palette = gr.Checkbox(label="Enable", value=False)
|
89 |
palette_image = gr.Image(label="Color palette image", type="pil")
|
90 |
palette_colors = gr.Slider(label="Palette Size (only for complex images)", minimum=1, maximum=256, step=1, value=16)
|
91 |
|
92 |
+
with gr.TabItem("Post-Processing"):
|
93 |
+
downscale = gr.Slider(label="Downscale", minimum=1, maximum=32, step=2, value=8)
|
94 |
+
limit_colors = gr.Checkbox(label="Limit Colors")
|
95 |
+
grayscale = gr.Checkbox(label="Grayscale")
|
96 |
+
black_and_white = gr.Checkbox(label="Black and White")
|
97 |
+
|
98 |
post_process_button = gr.Button("Apply Post-Processing")
|
99 |
+
|
100 |
gallery.select(update_selection, outputs=[prompt, selected_info, selected_state])
|
101 |
prompt.submit(fn=run_lora, inputs=[prompt, selected_state], outputs=[result, refined_result])
|
102 |
post_process_button.click(fn=apply_post_processing, inputs=[refined_result, downscale, limit_colors, grayscale, black_and_white], outputs=[post_processed_result])
|
103 |
+
|
104 |
app.queue(max_size=20, concurrency_count=5)
|
105 |
app.launch()
|