Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,29 @@
|
|
1 |
-
from rembg import remove
|
2 |
import gradio as gr
|
3 |
from PIL import Image
|
4 |
-
import
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
# Gradio arayüzü
|
12 |
interface = gr.Interface(
|
13 |
-
fn=
|
14 |
-
inputs=
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
examples=[
|
19 |
-
["
|
20 |
]
|
21 |
)
|
22 |
|
23 |
-
# Uygulamayı başlat
|
24 |
interface.launch()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
+
import torch
|
4 |
+
from deoldify import device
|
5 |
+
from deoldify.device_id import DeviceId
|
6 |
+
from deoldify.visualize import get_image_colorizer
|
7 |
|
8 |
+
device.set(device=DeviceId.GPU0 if torch.cuda.is_available() else DeviceId.CPU)
|
9 |
+
colorizer = get_image_colorizer(artistic=True)
|
10 |
+
|
11 |
+
def colorize_image(image, render_factor):
|
12 |
+
result = colorizer.get_transformed_image(image, render_factor=render_factor)
|
13 |
+
return result
|
14 |
|
|
|
15 |
interface = gr.Interface(
|
16 |
+
fn=colorize_image,
|
17 |
+
inputs=[
|
18 |
+
gr.Image(type="pil", label="Siyah Beyaz Görsel Yükle"),
|
19 |
+
gr.Slider(minimum=10, maximum=50, default=35, step=1, label="Renklendirme Yoğunluğu")
|
20 |
+
],
|
21 |
+
outputs=gr.Image(type="pil", label="Renklendirilmiş Görsel"),
|
22 |
+
title="Siyah Beyaz Görsel Renklendirme",
|
23 |
+
description="Siyah beyaz bir görsel yükleyin ve renklendirme yoğunluğunu ayarlayarak renklendirin!",
|
24 |
examples=[
|
25 |
+
["example_bw.jpg", 35] # Örnek görsel ve varsayılan render_factor
|
26 |
]
|
27 |
)
|
28 |
|
|
|
29 |
interface.launch()
|