tori29umai commited on
Commit
42263c5
β€’
1 Parent(s): 6dfe6c8
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -161,15 +161,14 @@ class webui:
161
  def __init__(self):
162
  self.demo = gr.Blocks()
163
 
164
- def main(self, image_path):
165
  image = Image.open(image_path).convert('RGBA')
166
- #ζ‹‘εΌ΅ε­γ‚’ε–γ‚Šι™€γ„γŸγƒ•γ‚‘γ‚€γƒ«εγ‚’ε–εΎ—
167
  image_name = os.path.splitext(image_path)[0]
168
  alpha = image.getchannel('A') if image.mode == 'RGBA' else None
169
  image.save(image_path)
170
  image = Image.open(image_path).convert('RGBA')
171
  rgb_image = image.convert('RGB')
172
- lineart = process_XDoG(image_path).convert('L')
173
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
174
 
175
  if alpha:
@@ -197,6 +196,10 @@ class webui:
197
  with gr.Row():
198
  with gr.Column():
199
  input_image = gr.Image(type='filepath', image_mode="RGBA", label="Original Image")
 
 
 
 
200
  submit = gr.Button(value="Start")
201
  with gr.Row():
202
  with gr.Column():
@@ -205,7 +208,7 @@ class webui:
205
  output_file = gr.File()
206
  submit.click(
207
  self.main,
208
- inputs=[input_image],
209
  outputs=[output_0, output_file]
210
  )
211
 
 
161
  def __init__(self):
162
  self.demo = gr.Blocks()
163
 
164
+ def main(self, image_path, kernel_size, sigma, k_sigma, gamma):
165
  image = Image.open(image_path).convert('RGBA')
 
166
  image_name = os.path.splitext(image_path)[0]
167
  alpha = image.getchannel('A') if image.mode == 'RGBA' else None
168
  image.save(image_path)
169
  image = Image.open(image_path).convert('RGBA')
170
  rgb_image = image.convert('RGB')
171
+ lineart = process_XDoG(image_path, kernel_size, sigma, k_sigma, gamma).convert('L')
172
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
173
 
174
  if alpha:
 
196
  with gr.Row():
197
  with gr.Column():
198
  input_image = gr.Image(type='filepath', image_mode="RGBA", label="Original Image")
199
+ kernel_size_input = gr.Number(value=0, label="Kernel Size", precision=0)
200
+ sigma_input = gr.Number(value=1.0, label="Sigma")
201
+ k_sigma_input = gr.Number(value=2.0, label="K Sigma")
202
+ gamma_input = gr.Number(value=1.5, label="Gamma")
203
  submit = gr.Button(value="Start")
204
  with gr.Row():
205
  with gr.Column():
 
208
  output_file = gr.File()
209
  submit.click(
210
  self.main,
211
+ inputs=[input_image, kernel_size_input, sigma_input, k_sigma_input, gamma_input],
212
  outputs=[output_0, output_file]
213
  )
214