artificialguybr commited on
Commit
13070d7
·
1 Parent(s): ddf5341

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -23
app.py CHANGED
@@ -71,29 +71,31 @@ 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
- 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
 
 
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
+ palette_size_color = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
78
+ quantization_methods_color = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
79
+ dither_methods_color = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
80
+ k_means_color = gr.Checkbox(label="Enable k-means for color quantization", value=True)
81
+
82
+ with gr.TabItem("Grayscale"):
83
+ enable_grayscale = gr.Checkbox(label="Enable", value=False)
84
+ palette_size_gray = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
85
+ quantization_methods_gray = gr.Radio(choices=["Median Cut", "Maximum Coverage", "Fast Octree"], label="Colors Quantization Method")
86
+ dither_methods_gray = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
87
+ k_means_gray = gr.Checkbox(label="Enable k-means for color quantization", value=True)
88
+
89
+ with gr.TabItem("Black and white"):
90
+ enable_black_and_white = gr.Checkbox(label="Enable", value=False)
91
+ inverse_black_and_white = gr.Checkbox(label="Inverse", value=False)
92
+ threshold_black_and_white = gr.Slider(label="Threshold", minimum=1, maximum=256, step=1, value=128)
93
+
94
+ with gr.TabItem("Custom color palette"):
95
+ enable_custom_palette = gr.Checkbox(label="Enable", value=False)
96
+ palette_image = gr.Image(label="Color palette image", type="pil")
97
+ palette_size_custom = gr.Slider(label="Palette Size", minimum=1, maximum=256, step=1, value=16)
98
+ dither_methods_custom = gr.Radio(choices=["None", "Floyd-Steinberg"], label="Colors Dither Method")
99
 
100
  post_process_button = gr.Button("Apply Post-Processing")
101