Kims12 commited on
Commit
7c01b96
ยท
verified ยท
1 Parent(s): 4e7b811

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -79,25 +79,23 @@ def get_filter_description(filter_type):
79
  }
80
  return descriptions.get(filter_type, "")
81
 
82
- iface = gr.Interface(
83
- fn=convert_and_save,
84
- inputs=[
85
- "image",
86
- gr.Radio(
87
- ["Grayscale", "Soft Glow", "Portrait Enhancer", "Warm Tone", "Cold Tone", "High-Key", "Low-Key", "Haze"],
88
- label="ํ•„ํ„ฐ ์„ ํƒ"
89
- ),
90
- gr.Slider(minimum=1, maximum=100, value=50, label="ํ•„ํ„ฐ ๊ฐ•๋„")
91
- ],
92
- outputs=["image", "file", gr.Markdown()],
93
- title="์ด๋ฏธ์ง€ ํ•„ํ„ฐ ๋ฐ ํ‘๋ฐฑ ๋ณ€ํ™˜๊ธฐ",
94
- description="์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ํ•„ํ„ฐ์™€ ๊ฐ•๋„๋ฅผ ์„ ํƒํ•˜๋ฉด, ๋ณ€ํ™˜๋œ ์ด๋ฏธ์ง€๋ฅผ JPG ํŒŒ์ผ๋กœ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.",
95
- live=True
96
- )
97
 
98
- def update_description(filter_type):
99
- return get_filter_description(filter_type)
100
 
101
- iface.inputs[1].change(fn=update_description, inputs=iface.inputs[1], outputs=iface.outputs[2])
 
 
102
 
103
  iface.launch()
 
79
  }
80
  return descriptions.get(filter_type, "")
81
 
82
+ with gr.Blocks() as iface:
83
+ with gr.Row():
84
+ with gr.Column():
85
+ image_input = gr.Image(type="pil", label="์ด๋ฏธ์ง€ ์—…๋กœ๋“œ")
86
+ filter_input = gr.Radio(
87
+ ["Grayscale", "Soft Glow", "Portrait Enhancer", "Warm Tone", "Cold Tone", "High-Key", "Low-Key", "Haze"],
88
+ label="ํ•„ํ„ฐ ์„ ํƒ",
89
+ value="Soft Glow"
90
+ )
91
+ intensity_slider = gr.Slider(1, 100, value=50, label="ํ•„ํ„ฐ ๊ฐ•๋„")
92
+ description_output = gr.Markdown(get_filter_description("Soft Glow"))
 
 
 
 
93
 
94
+ with gr.Column():
95
+ output_image = gr.Image(type="pil", label="๊ฒฐ๊ณผ ์ด๋ฏธ์ง€")
96
 
97
+ filter_input.change(fn=lambda filter_type: get_filter_description(filter_type), inputs=filter_input, outputs=description_output)
98
+ process_button = gr.Button("ํ•„ํ„ฐ ์ ์šฉ")
99
+ process_button.click(fn=convert_and_save, inputs=[image_input, filter_input, intensity_slider], outputs=output_image)
100
 
101
  iface.launch()