Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2 as cv
|
2 |
+
import numpy as np
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
|
6 |
+
# Görseli siyah-beyaza dönüştüren fonksiyon
|
7 |
+
def nostalji(image):
|
8 |
+
image = np.array(image)
|
9 |
+
gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
|
10 |
+
return gray_image
|
11 |
+
|
12 |
+
|
13 |
+
# Gradio arayüzü oluştur
|
14 |
+
with gr.Blocks() as demo:
|
15 |
+
gr.Markdown("# Görseli Siyah Beyaza Çevir!")
|
16 |
+
gr.Markdown("Bir resim yükleyin ve siyah beyaza çevrilsin!")
|
17 |
+
|
18 |
+
image_input = gr.Image(type="pil", label="Girdi Görseli")
|
19 |
+
image_output = gr.Image(type="numpy", label="Sonuç Görseli")
|
20 |
+
|
21 |
+
# Bileşenleri fonksiyonla bağla
|
22 |
+
btn = gr.Button("Çevir")
|
23 |
+
btn.click(fn=nostalji, inputs=image_input, outputs=image_output)
|
24 |
+
|
25 |
+
# Gradio arayüzünü başlat
|
26 |
+
demo.launch(share=True)
|