borakol commited on
Commit
eb53b67
·
verified ·
1 Parent(s): 34e2642

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2 as cv
2
+ import numpy as np
3
+ import gradio as gr
4
+
5
+ def convertToGray(image):
6
+ image = np.array(image)
7
+ gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
8
+ return gray_image
9
+
10
+ # gradio arayüzünü oluşturalım
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown("# Görseli Siyah Beyaza Çevir!")
13
+ gr.Markdown("Bir resim yükleyin ve siyah beyaza çevirin.")
14
+
15
+ with gr.Row():
16
+ with gr.Column():
17
+ image_input = gr.Image(type="pil" , label = "Input Image")
18
+ with gr.Column():
19
+ image_output = gr.Image(type = "numpy" ,
20
+ label = "Output Image")
21
+
22
+ btn = gr.Button("Convert")
23
+ btn.click(
24
+ fn = convertToGray,
25
+ inputs = image_input,
26
+ outputs = image_output
27
+ )
28
+
29
+ if __name__ == "__main__":
30
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ opencv-python
2
+ gradio
3
+ numpy