File size: 1,714 Bytes
cbd40b0
 
917b9de
cbd40b0
9c2e84a
 
 
 
fba64bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9d28208
9c2e84a
fba64bd
9d28208
4d57a45
fba64bd
9c2e84a
fba64bd
9c2e84a
cbd40b0
9c2e84a
 
917b9de
cbd40b0
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import gradio as gr
from rembg import remove
from PIL import Image

def bg_remove(input_img):
    if input_img is None:
        return None
    img = Image.open(input_img)
    out = remove(img)
    return out

canva_css = """
<style>

body, .gradio-container {
    background: linear-gradient(135deg, #6EE7B7, #3B82F6, #9333EA);
    background-size: 300% 300%;
    animation: gradientFlow 12s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.card {
    backdrop-filter: blur(25px);
    background: rgba(255,255,255,0.25);
    border-radius: 22px;
    padding: 25px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.2);
}

button {
    background: linear-gradient(90deg, #FF8A05, #FF4D00);
    border-radius: 14px !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: bold;
    transition: 0.3s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(255,76,0,0.4);
}

h1 {
    color: white !important;
    text-shadow: 0 4px 12px rgba(0,0,0,0.4);
    font-weight: 800;
}

</style>
"""

with gr.Blocks() as demo:
    gr.HTML(canva_css)  

    gr.HTML("<h1>✨ Canva Style Background Remover Pro</h1>")
    gr.HTML("<p style='color:white;font-size:20px;'>Upload an image and get a clean transparent background instantly!</p>")

    with gr.Row():
        with gr.Column(elem_id="upload-card"):
            inp = gr.Image(label="Upload Image", type="filepath")
        with gr.Column(elem_id="output-card"):
            out = gr.Image(label="Output")

    btn = gr.Button("Remove Background")
    btn.click(bg_remove, inp, out)

demo.launch()