tori29umai commited on
Commit
c575ad5
·
1 Parent(s): d1fad40
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -54,7 +54,7 @@ def replace_color(image, color_1, blur_radius=2):
54
  while np.any(matches):
55
  new_matches = np.zeros_like(matches)
56
  match_num = np.sum(matches)
57
- for i in range(len(data)): # Removed tqdm
58
  if matches[i]:
59
  x, y = divmod(i, original_shape[1])
60
  neighbors = [
@@ -166,11 +166,9 @@ class webui:
166
  #拡張子を取り除いたファイル名を取得
167
  image_name = os.path.splitext(image_path)[0]
168
  alpha = image.getchannel('A') if image.mode == 'RGBA' else None
169
- image_png_path = f"{image_name}.png"
170
- image.save(image_png_path)
171
- image = Image.open(image_png_path).convert('RGBA')
172
  rgb_image = image.convert('RGB')
173
- lineart = process_XDoG(image_png_path).convert('L')
174
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
175
 
176
  if alpha:
@@ -197,7 +195,7 @@ class webui:
197
  with self.demo:
198
  with gr.Row():
199
  with gr.Column():
200
- input_image = gr.Image(type='filepath', label="Original Image")
201
  submit = gr.Button(value="Start")
202
  with gr.Row():
203
  with gr.Column():
 
54
  while np.any(matches):
55
  new_matches = np.zeros_like(matches)
56
  match_num = np.sum(matches)
57
+ for i in range(len(data)):
58
  if matches[i]:
59
  x, y = divmod(i, original_shape[1])
60
  neighbors = [
 
166
  #拡張子を取り除いたファイル名を取得
167
  image_name = os.path.splitext(image_path)[0]
168
  alpha = image.getchannel('A') if image.mode == 'RGBA' else None
169
+ image = Image.open(image_path).convert('RGBA')
 
 
170
  rgb_image = image.convert('RGB')
171
+ lineart = process_XDoG(image_path).convert('L')
172
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
173
 
174
  if alpha:
 
195
  with self.demo:
196
  with gr.Row():
197
  with gr.Column():
198
+ input_image = gr.Image(type='filepath', image_mode="RGBA", label="Original Image(png画像にのみ対応しています)")
199
  submit = gr.Button(value="Start")
200
  with gr.Row():
201
  with gr.Column():