Kims12 commited on
Commit
7c01b96
β€’
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()