ImageToGray / app.py
borakol's picture
Upload 2 files
eb53b67 verified
raw
history blame contribute delete
827 Bytes
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()