| import cv2 | |
| import gradio as gr | |
| def opencv_function(input_image): | |
| # OpenCVを使用した画像処理の例 | |
| processed_image = cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY) | |
| return processed_image | |
| iface = gr.Interface( | |
| fn=opencv_function, | |
| inputs=gr.Image(), # 画像の入力を指定 | |
| outputs=gr.Image(), # 出力も画像として指定 | |
| ) | |
| iface.launch() | |