ihabooe commited on
Commit
06666f8
·
verified ·
1 Parent(s): 78d7262

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +138 -70
app.py CHANGED
@@ -93,115 +93,178 @@ def process(image, progress=gr.Progress()):
93
  title = "Background Removal Tool"
94
  description = """
95
  <div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;">
96
- <h1 style="color: #2D3748; font-size: 2.5em; margin-bottom: 20px;">Professional Background Removal</h1>
97
- <p style="color: #4A5568; font-size: 1.2em; margin-bottom: 20px;">
98
- Upload your image and get instant background removal using AI technology.
 
 
 
 
 
 
 
 
 
99
  </p>
100
  </div>
101
  """
102
 
103
  # Create the Gradio interface
104
  with gr.Blocks(css="""
 
 
 
 
 
 
 
 
 
105
  /* Global styles */
106
- .container {
107
- max-width: 1200px;
108
- margin: 0 auto;
109
- padding: 2rem;
110
  }
111
-
112
- /* Card styling */
113
- .input-card, .output-card {
114
- background-color: white;
115
- border-radius: 10px;
116
- padding: 20px;
117
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
118
- transition: transform 0.2s;
119
  }
120
-
121
- .input-card:hover, .output-card:hover {
122
- transform: translateY(-5px);
 
 
 
 
123
  }
124
-
125
- /* Button styling */
126
- .download-btn {
127
- background-color: #4F46E5 !important;
128
- color: white !important;
129
- border: none !important;
130
- padding: 12px 28px !important;
131
- text-align: center !important;
132
- text-decoration: none !important;
133
- display: inline-block !important;
134
- font-size: 16px !important;
135
- margin: 15px 0 !important;
136
- cursor: pointer !important;
137
- border-radius: 8px !important;
138
- transition: all 0.3s ease !important;
139
- font-weight: 600 !important;
140
  }
141
-
142
- .download-btn:hover {
143
- background-color: #4338CA !important;
144
- transform: translateY(-2px);
145
- box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
 
 
 
 
 
146
  }
147
-
148
- /* File download styling */
149
- .download-container [data-testid="file"] {
150
- display: block !important;
 
 
 
151
  }
152
-
153
- .download-container [data-testid="file"] > div:first-child {
154
- display: none !important;
 
 
 
 
 
155
  }
156
-
157
- .download-container [data-testid="file"] > div:last-child {
158
- margin-left: 0 !important;
 
 
 
 
159
  }
160
-
 
 
 
 
 
 
161
  .download-container [data-testid="file"] button {
162
- background-color: #4F46E5 !important;
163
  color: white !important;
164
  border: none !important;
165
  padding: 12px 28px !important;
166
- text-align: center !important;
167
  font-size: 16px !important;
168
- margin: 15px 0 !important;
169
- cursor: pointer !important;
 
170
  border-radius: 8px !important;
 
171
  transition: all 0.3s ease !important;
172
- width: 100% !important;
173
- font-weight: 600 !important;
174
  }
175
-
176
  .download-container [data-testid="file"] button:hover {
177
- background-color: #4338CA !important;
178
- transform: translateY(-2px);
179
- box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
180
  }
181
-
182
- /* Label styling */
183
  label {
184
- font-weight: 600 !important;
185
- color: #2D3748 !important;
186
  font-size: 1.1em !important;
187
- margin-bottom: 8px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
189
  """) as demo:
190
  gr.Markdown(description)
191
 
192
  with gr.Row(equal_height=True):
193
- with gr.Column(scale=1, elem_classes="input-card"):
194
  input_image = gr.Image(
195
  type="numpy",
196
  label="Upload Your Image",
197
- elem_id="input-image"
 
198
  )
199
 
200
- with gr.Column(scale=1, elem_classes="output-card"):
201
  output_image = gr.Image(
202
  type="numpy",
203
  label="Result",
204
- elem_id="output-image"
 
205
  )
206
 
207
  with gr.Row(elem_classes="download-container"):
@@ -221,4 +284,9 @@ with gr.Blocks(css="""
221
  )
222
 
223
  if __name__ == "__main__":
224
- demo.launch(share=False)
 
 
 
 
 
 
93
  title = "Background Removal Tool"
94
  description = """
95
  <div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;">
96
+ <div class="logo-container">
97
+ <div class="logo-mark">
98
+ <div class="logo-hexagon"></div>
99
+ <div class="logo-inner">A</div>
100
+ </div>
101
+ <div class="logo-text">AicO Tools</div>
102
+ </div>
103
+ <h1 style="color: #00ffff; font-size: 2.5em; margin: 20px 0; text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);">
104
+ AI Background Removal
105
+ </h1>
106
+ <p style="color: #a0a0a0; font-size: 1.2em;">
107
+ Remove backgrounds instantly using advanced AI technology
108
  </p>
109
  </div>
110
  """
111
 
112
  # Create the Gradio interface
113
  with gr.Blocks(css="""
114
+ /* Variables */
115
+ :root {
116
+ --neon-cyan: #00ffff;
117
+ --neon-pink: #ff00de;
118
+ --neon-yellow: #ffdd00;
119
+ --dark-background: #0a0a1e;
120
+ --deep-blue: #121238;
121
+ }
122
+
123
  /* Global styles */
124
+ body {
125
+ font-family: 'Roboto Mono', monospace;
126
+ background: linear-gradient(135deg, var(--dark-background) 0%, var(--deep-blue) 100%);
127
+ color: #ffffff;
128
  }
129
+
130
+ /* Logo styling */
131
+ .logo-container {
132
+ display: flex;
133
+ align-items: center;
134
+ margin-bottom: 2rem;
135
+ animation: float 3s ease-in-out infinite;
 
136
  }
137
+
138
+ .logo-mark {
139
+ position: relative;
140
+ width: 40px;
141
+ height: 40px;
142
+ margin-right: 12px;
143
+ animation: spin 12s linear infinite;
144
  }
145
+
146
+ .logo-hexagon {
147
+ position: absolute;
148
+ width: 100%;
149
+ height: 100%;
150
+ background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
151
+ clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
152
+ animation: pulse-glow 4s infinite alternate;
 
 
 
 
 
 
 
 
153
  }
154
+
155
+ .logo-inner {
156
+ position: absolute;
157
+ top: 50%;
158
+ left: 50%;
159
+ transform: translate(-50%, -50%);
160
+ color: var(--neon-cyan);
161
+ font-family: 'Orbitron', sans-serif;
162
+ font-weight: 700;
163
+ font-size: 20px;
164
  }
165
+
166
+ .logo-text {
167
+ font-family: 'Orbitron', sans-serif;
168
+ font-size: 24px;
169
+ font-weight: 700;
170
+ color: var(--neon-pink);
171
+ text-shadow: 0 0 10px rgba(255, 0, 222, 0.5);
172
  }
173
+
174
+ /* Container styling */
175
+ .container {
176
+ background: rgba(0, 0, 0, 0.6);
177
+ backdrop-filter: blur(10px);
178
+ border-radius: 10px;
179
+ padding: 20px;
180
+ box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
181
  }
182
+
183
+ /* Input/Output areas */
184
+ .input-image, .output-image {
185
+ background: rgba(18, 18, 56, 0.7) !important;
186
+ border: 2px solid var(--neon-cyan) !important;
187
+ border-radius: 8px !important;
188
+ transition: all 0.3s ease !important;
189
  }
190
+
191
+ .input-image:hover, .output-image:hover {
192
+ box-shadow: 0 0 15px rgba(0, 255, 255, 0.3) !important;
193
+ transform: translateY(-2px) !important;
194
+ }
195
+
196
+ /* Download button styling */
197
  .download-container [data-testid="file"] button {
198
+ background: linear-gradient(45deg, var(--neon-cyan), var(--neon-pink)) !important;
199
  color: white !important;
200
  border: none !important;
201
  padding: 12px 28px !important;
202
+ font-family: 'Orbitron', sans-serif !important;
203
  font-size: 16px !important;
204
+ font-weight: 600 !important;
205
+ text-transform: uppercase !important;
206
+ letter-spacing: 1px !important;
207
  border-radius: 8px !important;
208
+ cursor: pointer !important;
209
  transition: all 0.3s ease !important;
210
+ animation: pulse-glow 2s infinite alternate !important;
 
211
  }
212
+
213
  .download-container [data-testid="file"] button:hover {
214
+ transform: translateY(-2px) !important;
215
+ box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4) !important;
 
216
  }
217
+
218
+ /* Labels */
219
  label {
220
+ color: var(--neon-cyan) !important;
221
+ font-family: 'Orbitron', sans-serif !important;
222
  font-size: 1.1em !important;
223
+ text-shadow: 0 0 5px rgba(0, 255, 255, 0.5) !important;
224
+ }
225
+
226
+ /* Progress bar */
227
+ .progress-bar {
228
+ background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink)) !important;
229
+ height: 4px !important;
230
+ border-radius: 2px !important;
231
+ box-shadow: 0 0 10px rgba(0, 255, 255, 0.5) !important;
232
+ }
233
+
234
+ /* Animations */
235
+ @keyframes float {
236
+ 0% { transform: translateY(0); }
237
+ 50% { transform: translateY(-5px); }
238
+ 100% { transform: translateY(0); }
239
+ }
240
+
241
+ @keyframes spin {
242
+ 0% { transform: rotateY(0deg); }
243
+ 100% { transform: rotateY(360deg); }
244
+ }
245
+
246
+ @keyframes pulse-glow {
247
+ 0% { filter: brightness(1) drop-shadow(0 0 5px var(--neon-cyan)); }
248
+ 100% { filter: brightness(1.2) drop-shadow(0 0 10px var(--neon-cyan)); }
249
  }
250
  """) as demo:
251
  gr.Markdown(description)
252
 
253
  with gr.Row(equal_height=True):
254
+ with gr.Column(scale=1):
255
  input_image = gr.Image(
256
  type="numpy",
257
  label="Upload Your Image",
258
+ elem_id="input-image",
259
+ elem_classes="input-image"
260
  )
261
 
262
+ with gr.Column(scale=1):
263
  output_image = gr.Image(
264
  type="numpy",
265
  label="Result",
266
+ elem_id="output-image",
267
+ elem_classes="output-image"
268
  )
269
 
270
  with gr.Row(elem_classes="download-container"):
 
284
  )
285
 
286
  if __name__ == "__main__":
287
+ demo.launch(
288
+ share=False,
289
+ head="""
290
+ <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&family=Roboto+Mono:wght@300;400;700&display=swap" rel="stylesheet">
291
+ """
292
+ )