Spaces:
Runtime error
Runtime error
artificialguybr
commited on
Commit
•
08e5b6d
1
Parent(s):
71f794e
Update app.py
Browse files
app.py
CHANGED
@@ -139,6 +139,39 @@ def postprocess(
|
|
139 |
|
140 |
return processed_image
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
with gr.Blocks() as app:
|
143 |
title = gr.Markdown("# artificialguybr LoRA portfolio")
|
144 |
description = gr.Markdown("### This is a Pixel Art Generator using SD Loras.")
|
|
|
139 |
|
140 |
return processed_image
|
141 |
|
142 |
+
def run_and_postprocess(prompt, selected_state, enabled, downscale, need_rescale, enable_color_limit, palette_size_color, quantization_methods_color, dither_methods_color, k_means_color, enable_grayscale, palette_size_gray, quantization_methods_gray, dither_methods_gray, k_means_gray, enable_black_and_white, inverse_black_and_white, threshold_black_and_white, enable_custom_palette, palette_image, palette_size_custom, dither_methods_custom):
|
143 |
+
# Run the original image generation
|
144 |
+
original_image = run_lora(prompt, selected_state)
|
145 |
+
|
146 |
+
# Post-process the image if needed
|
147 |
+
if enabled:
|
148 |
+
processed_image = postprocess(
|
149 |
+
original_image,
|
150 |
+
enabled,
|
151 |
+
downscale,
|
152 |
+
need_rescale,
|
153 |
+
enable_color_limit,
|
154 |
+
palette_size_color,
|
155 |
+
quantization_methods_color,
|
156 |
+
dither_methods_color,
|
157 |
+
k_means_color,
|
158 |
+
enable_grayscale,
|
159 |
+
palette_size_gray,
|
160 |
+
quantization_methods_gray,
|
161 |
+
dither_methods_gray,
|
162 |
+
k_means_gray,
|
163 |
+
enable_black_and_white,
|
164 |
+
inverse_black_and_white,
|
165 |
+
threshold_black_and_white,
|
166 |
+
enable_custom_palette,
|
167 |
+
palette_image,
|
168 |
+
palette_size_custom,
|
169 |
+
dither_methods_custom
|
170 |
+
)
|
171 |
+
return processed_image
|
172 |
+
else:
|
173 |
+
return original_image
|
174 |
+
|
175 |
with gr.Blocks() as app:
|
176 |
title = gr.Markdown("# artificialguybr LoRA portfolio")
|
177 |
description = gr.Markdown("### This is a Pixel Art Generator using SD Loras.")
|