alexa81sumit commited on
Commit
fba64bd
·
verified ·
1 Parent(s): dbb1f2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -7
app.py CHANGED
@@ -1,23 +1,70 @@
1
  import gradio as gr
2
  from rembg import remove
3
  from PIL import Image
4
- import io
5
 
6
  def bg_remove(input_img):
7
  if input_img is None:
8
  return None
9
  img = Image.open(input_img)
10
- result = remove(img)
11
- return result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- with gr.Blocks(css="custom.css") as demo:
14
  gr.HTML("<h1>✨ Canva Style Background Remover Pro</h1>")
15
- gr.HTML("<p style='color:white;font-size:20px;'>Upload any image Get clean transparent background instantly!</p>")
16
 
17
  with gr.Row():
18
- with gr.Column():
19
  inp = gr.Image(label="Upload Image", type="filepath")
20
- with gr.Column():
21
  out = gr.Image(label="Output")
22
 
23
  btn = gr.Button("Remove Background")
 
1
  import gradio as gr
2
  from rembg import remove
3
  from PIL import Image
 
4
 
5
  def bg_remove(input_img):
6
  if input_img is None:
7
  return None
8
  img = Image.open(input_img)
9
+ out = remove(img)
10
+ return out
11
+
12
+ canva_css = """
13
+ <style>
14
+
15
+ body, .gradio-container {
16
+ background: linear-gradient(135deg, #6EE7B7, #3B82F6, #9333EA);
17
+ background-size: 300% 300%;
18
+ animation: gradientFlow 12s ease infinite;
19
+ }
20
+
21
+ @keyframes gradientFlow {
22
+ 0% { background-position: 0% 50%; }
23
+ 50% { background-position: 100% 50%; }
24
+ 100% { background-position: 0% 50%; }
25
+ }
26
+
27
+ .card {
28
+ backdrop-filter: blur(25px);
29
+ background: rgba(255,255,255,0.25);
30
+ border-radius: 22px;
31
+ padding: 25px;
32
+ box-shadow: 0 10px 35px rgba(0,0,0,0.2);
33
+ }
34
+
35
+ button {
36
+ background: linear-gradient(90deg, #FF8A05, #FF4D00);
37
+ border-radius: 14px !important;
38
+ color: white !important;
39
+ font-size: 18px !important;
40
+ font-weight: bold;
41
+ transition: 0.3s;
42
+ }
43
+
44
+ button:hover {
45
+ transform: scale(1.05);
46
+ box-shadow: 0 8px 20px rgba(255,76,0,0.4);
47
+ }
48
+
49
+ h1 {
50
+ color: white !important;
51
+ text-shadow: 0 4px 12px rgba(0,0,0,0.4);
52
+ font-weight: 800;
53
+ }
54
+
55
+ </style>
56
+ """
57
+
58
+ with gr.Blocks() as demo:
59
+ gr.HTML(canva_css)
60
 
 
61
  gr.HTML("<h1>✨ Canva Style Background Remover Pro</h1>")
62
+ gr.HTML("<p style='color:white;font-size:20px;'>Upload an image and get a clean transparent background instantly!</p>")
63
 
64
  with gr.Row():
65
+ with gr.Column(elem_id="upload-card"):
66
  inp = gr.Image(label="Upload Image", type="filepath")
67
+ with gr.Column(elem_id="output-card"):
68
  out = gr.Image(label="Output")
69
 
70
  btn = gr.Button("Remove Background")