File size: 609 Bytes
5c41c67
 
 
9be5ec6
5c41c67
 
203ac88
5c41c67
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)