Spaces:
Sleeping
Sleeping
| import os | |
| os.system("""python -m pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pip setuptools | |
| pip install -i https://mirrors.aliyun.com/pypi/simple/ gradio | |
| pip install -i https://mirrors.aliyun.com/pypi/simple/ opencv-python | |
| """) | |
| import numpy as np | |
| import gradio as gr | |
| import cv2 | |
| def gray(input_img): | |
| grayImage = cv2.cvtColor(input_img, cv2.COLOR_BGR2GRAY) | |
| return grayImage | |
| input = gr.Image(height=300, width=300, label="Upload Image") #label 代表输入框的标题 | |
| output = gr.Image() | |
| demo = gr.Interface(fn=gray, inputs=input, outputs = output) | |
| demo.launch(share=True) |