artificialguybr commited on
Commit
54b2d3b
1 Parent(s): 08e5b6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -26
app.py CHANGED
@@ -140,37 +140,47 @@ def postprocess(
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")
 
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
+ # Debug: Starting the function
144
+ logging.debug("Starting run_and_postprocess function.")
145
+
146
  # Run the original image generation
147
  original_image = run_lora(prompt, selected_state)
148
 
149
+ # Debug: Confirming that the original image was generated
150
+ logging.debug("Original image generated.")
151
+
152
+ # Post-process the image based on user input
153
+ processed_image = postprocess(
154
+ original_image,
155
+ enabled,
156
+ downscale,
157
+ need_rescale,
158
+ enable_color_limit,
159
+ palette_size_color,
160
+ quantization_methods_color,
161
+ dither_methods_color,
162
+ k_means_color,
163
+ enable_grayscale,
164
+ palette_size_gray,
165
+ quantization_methods_gray,
166
+ dither_methods_gray,
167
+ k_means_gray,
168
+ enable_black_and_white,
169
+ inverse_black_and_white,
170
+ threshold_black_and_white,
171
+ enable_custom_palette,
172
+ palette_image,
173
+ palette_size_custom,
174
+ dither_methods_custom
175
+ )
176
+
177
+ # Debug: Confirming that post-processing was applied
178
  if enabled:
179
+ logging.debug("Post-processing applied.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  else:
181
+ logging.debug("Post-processing not applied.")
182
+
183
+ return processed_image if enabled else original_image
184
 
185
  with gr.Blocks() as app:
186
  title = gr.Markdown("# artificialguybr LoRA portfolio")