kijeoung commited on
Commit
8db3ad1
ยท
verified ยท
1 Parent(s): e4c233a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -44,17 +44,20 @@ with gr.Blocks() as app:
44
  apply_button = gr.Button("ํ•„ํ„ฐ ์ ์šฉ")
45
 
46
  with gr.Row():
47
- before_image = gr.Image(label="๋ณ€๊ฒฝ ์ „", type="pil")
48
- after_image = gr.Image(label="๋ณ€๊ฒฝ ํ›„", type="pil")
49
 
50
- def apply_filter_and_show(image, filter_name, intensity):
51
  filtered_image = apply_filter(image, filter_name, intensity)
52
- return image, filtered_image # ๋ณ€๊ฒฝ ์ „, ๋ณ€๊ฒฝ ํ›„ ์ด๋ฏธ์ง€ ๋ฐ˜ํ™˜
 
 
 
 
53
 
54
  apply_button.click(
55
- fn=apply_filter_and_show,
56
  inputs=[input_image, filter_name, intensity],
57
- outputs=[before_image, after_image]
58
  )
59
 
60
  # ์‹คํ–‰
 
44
  apply_button = gr.Button("ํ•„ํ„ฐ ์ ์šฉ")
45
 
46
  with gr.Row():
47
+ comparison = gr.Image(label="๋ณ€๊ฒฝ ์ „ํ›„ ๋น„๊ต", type="pil")
 
48
 
49
+ def apply_filter_and_compare(image, filter_name, intensity):
50
  filtered_image = apply_filter(image, filter_name, intensity)
51
+ # ์Šฌ๋ผ์ด๋”๋ฅผ ์œ„ํ•œ ์ด๋ฏธ์ง€ ๊ฒฐํ•ฉ
52
+ before_after = Image.new("RGB", (image.width * 2, image.height))
53
+ before_after.paste(image, (0, 0))
54
+ before_after.paste(filtered_image, (image.width, 0))
55
+ return before_after
56
 
57
  apply_button.click(
58
+ fn=apply_filter_and_compare,
59
  inputs=[input_image, filter_name, intensity],
60
+ outputs=comparison
61
  )
62
 
63
  # ์‹คํ–‰