artificialguybr commited on
Commit
f39f62b
1 Parent(s): 1f74d50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -31
app.py CHANGED
@@ -71,38 +71,39 @@ with gr.Blocks() as app:
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
- # Post-Processing Options Above Tabs
75
- enable_post_processing = gr.Checkbox(label="Enable Post-Processing", value=False)
76
- downscale_slider = gr.Slider(label="Downscale", minimum=1, maximum=31, step=1, value=1)
77
- rescale_to_original = gr.Checkbox(label="Rescale to Original Size", value=True)
78
-
79
- with gr.Tabs():
80
- with gr.TabItem("Color"):
81
- enable_color_limit = gr.Checkbox(label="Enable", value=False)
82
- palette_size_color = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
83
- quantization_methods_color = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
84
- dither_methods_color = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
85
- k_means_color = gr.Checkbox(label="Enable k-means for color quantization", value=True)
86
-
87
- with gr.TabItem("Grayscale"):
88
- enable_grayscale = gr.Checkbox(label="Enable", value=False)
89
- palette_size_gray = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
90
- quantization_methods_gray = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
91
- dither_methods_gray = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
92
- k_means_gray = gr.Checkbox(label="Enable k-means for color quantization", value=True)
93
-
94
- with gr.TabItem("Black and white"):
95
- enable_black_and_white = gr.Checkbox(label="Enable", value=False)
96
- inverse_black_and_white = gr.Checkbox(label="Inverse", value=False)
97
- threshold_black_and_white = gr.Slider(label="Threshold", minimum=1, maximum=256, step=1, value=128)
98
-
99
- with gr.TabItem("Custom color palette"):
100
- enable_custom_palette = gr.Checkbox(label="Enable", value=False)
101
- palette_image = gr.Image(label="Color palette image", type="pil")
102
- palette_size_custom = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
103
- dither_methods_custom = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
104
 
105
- post_process_button = gr.Button("Apply Post-Processing")
 
 
 
 
 
 
106
 
107
  gallery.select(update_selection, outputs=[prompt, selected_info, selected_state])
108
  prompt.submit(fn=run_lora, inputs=[prompt, selected_state], outputs=[result, refined_result])
 
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.Blocks():
75
+ with gr.Accordion(label="Pixel art", open=False):
76
+ enabled = gr.Checkbox(label="Enable", value=False)
77
+ with gr.Row():
78
+ downscale = gr.Slider(label="Downscale", minimum=1, maximum=32, step=2, value=8)
79
+ need_rescale = gr.Checkbox(label="Rescale to original size", value=True)
80
+ with gr.Tabs():
81
+ with gr.TabItem("Color"):
82
+ enable_color_limit = gr.Checkbox(label="Enable", value=False)
83
+ palette_size_color = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
84
+ quantization_methods_color = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
85
+ dither_methods_color = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
86
+ k_means_color = gr.Checkbox(label="Enable k-means for color quantization", value=True)
87
+
88
+ with gr.TabItem("Grayscale"):
89
+ enable_grayscale = gr.Checkbox(label="Enable", value=False)
90
+ palette_size_gray = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
91
+ quantization_methods_gray = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
92
+ dither_methods_gray = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
93
+ k_means_gray = gr.Checkbox(label="Enable k-means for color quantization", value=True)
94
+
95
+ with gr.TabItem("Black and white"):
96
+ enable_black_and_white = gr.Checkbox(label="Enable", value=False)
97
+ inverse_black_and_white = gr.Checkbox(label="Inverse", value=False)
98
+ threshold_black_and_white = gr.Slider(label="Threshold", minimum=1, maximum=256, step=1, value=128)
 
 
 
 
 
99
 
100
+ with gr.TabItem("Custom color palette"):
101
+ enable_custom_palette = gr.Checkbox(label="Enable", value=False)
102
+ palette_image = gr.Image(label="Color palette image", type="pil")
103
+ palette_size_custom = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
104
+ dither_methods_custom = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
105
+
106
+ post_process_button = gr.Button("Apply Post-Processing")
107
 
108
  gallery.select(update_selection, outputs=[prompt, selected_info, selected_state])
109
  prompt.submit(fn=run_lora, inputs=[prompt, selected_state], outputs=[result, refined_result])