File size: 827 Bytes
eb53b67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import cv2 as cv 
import numpy as np 
import gradio as gr 

def convertToGray(image): 
    image = np.array(image)
    gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY) 
    return gray_image 

# gradio arayüzünü oluşturalım 
with gr.Blocks() as demo:
    gr.Markdown("# Görseli Siyah Beyaza Çevir!")
    gr.Markdown("Bir resim yükleyin ve siyah beyaza çevirin.")

    with gr.Row():
        with gr.Column():
            image_input = gr.Image(type="pil" , label = "Input Image")
        with gr.Column():
            image_output = gr.Image(type = "numpy" , 
            label = "Output Image")
    
    btn = gr.Button("Convert")
    btn.click(
        fn = convertToGray,
        inputs = image_input,
        outputs = image_output
    )

if __name__ == "__main__":
    demo.launch()