alrab222 commited on
Commit
6d88450
·
verified ·
1 Parent(s): 233cbfc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def convert_to_grayscale(image):
4
+ """
5
+ 入力された PIL 画像を白黒(グレースケール)に変換して返す関数です。
6
+ """
7
+ return image.convert("L")
8
+
9
+ # Gradio インターフェースの作成
10
+ demo = gr.Interface(
11
+ fn=convert_to_grayscale,
12
+ inputs=gr.Image(type="pil", label="画像をアップロードまたはドラッグ・アンド・ドロップ"),
13
+ outputs=gr.Image(type="pil", label="白黒画像"),
14
+ title="画像の白黒変換デモ",
15
+ description="アップロードした画像を白黒(グレースケール)に変換します。"
16
+ )
17
+
18
+ if __name__ == "__main__":
19
+ demo.launch()