yesok201 commited on
Commit
c09d102
·
verified ·
1 Parent(s): ef951dd

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +366 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Remove Back
3
- emoji: 👀
4
- colorFrom: green
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: remove-back
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,366 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ar" dir="rtl">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>أداة إزالة الخلفية الاحترافية</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Tajawal', sans-serif;
14
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
15
+ min-height: 100vh;
16
+ }
17
+
18
+ .dropzone {
19
+ border: 2px dashed #4a5568;
20
+ transition: all 0.3s ease;
21
+ }
22
+
23
+ .dropzone.active {
24
+ border-color: #4299e1;
25
+ background-color: rgba(66, 153, 225, 0.05);
26
+ }
27
+
28
+ .result-container {
29
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
30
+ transition: all 0.3s ease;
31
+ }
32
+
33
+ .loading-spinner {
34
+ animation: spin 1s linear infinite;
35
+ }
36
+
37
+ @keyframes spin {
38
+ 0% { transform: rotate(0deg); }
39
+ 100% { transform: rotate(360deg); }
40
+ }
41
+
42
+ .checkerboard {
43
+ background-image:
44
+ linear-gradient(45deg, #ccc 25%, transparent 25%),
45
+ linear-gradient(-45deg, #ccc 25%, transparent 25%),
46
+ linear-gradient(45deg, transparent 75%, #ccc 75%),
47
+ linear-gradient(-45deg, transparent 75%, #ccc 75%);
48
+ background-size: 20px 20px;
49
+ background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
50
+ }
51
+ </style>
52
+ </head>
53
+ <body class="text-gray-800">
54
+ <div class="container mx-auto px-4 py-8">
55
+ <!-- Header -->
56
+ <header class="text-center mb-12">
57
+ <h1 class="text-4xl font-bold text-blue-800 mb-2">أداة إزالة الخلفية</h1>
58
+ <p class="text-lg text-gray-600">قم بإزالة خلفية أي صورة بضغطة واحدة</p>
59
+ </header>
60
+
61
+ <!-- Main Content -->
62
+ <div class="flex flex-col lg:flex-row gap-8">
63
+ <!-- Upload Section -->
64
+ <div class="w-full lg:w-1/2">
65
+ <div class="bg-white rounded-xl shadow-lg p-6">
66
+ <div
67
+ id="dropzone"
68
+ class="dropzone rounded-lg p-8 text-center cursor-pointer hover:bg-blue-50 transition-colors"
69
+ >
70
+ <div class="flex flex-col items-center justify-center space-y-4">
71
+ <i class="fas fa-cloud-upload-alt text-5xl text-blue-500"></i>
72
+ <h3 class="text-xl font-semibold">اسحب وأسقط الصورة هنا</h3>
73
+ <p class="text-gray-500">أو انقر لاختيار صورة</p>
74
+ <input
75
+ type="file"
76
+ id="fileInput"
77
+ class="hidden"
78
+ accept="image/*"
79
+ >
80
+ <button
81
+ id="uploadBtn"
82
+ class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg font-medium transition-colors"
83
+ >
84
+ اختر صورة
85
+ </button>
86
+ </div>
87
+ </div>
88
+
89
+ <div class="mt-6">
90
+ <h3 class="font-semibold mb-2">إعدادات المعالجة</h3>
91
+ <div class="space-y-4">
92
+ <div>
93
+ <label class="block text-sm font-medium text-gray-700 mb-1">دقة المعالجة</label>
94
+ <select id="qualitySelect" class="w-full p-2 border border-gray-300 rounded-lg">
95
+ <option value="high">عالية (أفضل نتيجة)</option>
96
+ <option value="medium" selected>متوسطة (موصى بها)</option>
97
+ <option value="low">منخفضة (أسرع)</option>
98
+ </select>
99
+ </div>
100
+
101
+ <div>
102
+ <label class="block text-sm font-medium text-gray-700 mb-1">تنسيق المخرجات</label>
103
+ <select id="formatSelect" class="w-full p-2 border border-gray-300 rounded-lg">
104
+ <option value="png">PNG (شفاف)</option>
105
+ <option value="jpg" selected>JPG (خلفية بيضاء)</option>
106
+ <option value="webp">WebP (موصى به)</option>
107
+ </select>
108
+ </div>
109
+
110
+ <div class="flex items-center">
111
+ <input type="checkbox" id="autoDownload" class="mr-2">
112
+ <label for="autoDownload" class="text-sm text-gray-700">تنزيل تلقائي بعد المعالجة</label>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+
119
+ <!-- Result Section -->
120
+ <div class="w-full lg:w-1/2">
121
+ <div id="resultContainer" class="result-container bg-white rounded-xl shadow-lg p-6">
122
+ <div id="beforeAfterContainer" class="relative hidden">
123
+ <div class="flex justify-between mb-4">
124
+ <h3 class="font-semibold">قبل</h3>
125
+ <h3 class="font-semibold">بعد</h3>
126
+ </div>
127
+ <div class="flex space-x-4">
128
+ <div class="w-1/2">
129
+ <div class="checkerboard rounded-lg overflow-hidden">
130
+ <img id="originalImage" class="w-full h-auto" src="" alt="الصورة الأصلية">
131
+ </div>
132
+ </div>
133
+ <div class="w-1/2">
134
+ <div class="checkerboard rounded-lg overflow-hidden">
135
+ <img id="processedImage" class="w-full h-auto" src="" alt="الصورة المعالجة">
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+ <div class="mt-6 flex flex-wrap gap-3 justify-center">
141
+ <button id="downloadBtn" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg font-medium transition-colors flex items-center">
142
+ <i class="fas fa-download mr-2"></i> تنزيل النتيجة
143
+ </button>
144
+ <button id="newImageBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-4 py-2 rounded-lg font-medium transition-colors flex items-center">
145
+ <i class="fas fa-redo mr-2"></i> صورة جديدة
146
+ </button>
147
+ <button id="shareBtn" class="bg-blue-100 hover:bg-blue-200 text-blue-800 px-4 py-2 rounded-lg font-medium transition-colors flex items-center">
148
+ <i class="fas fa-share-alt mr-2"></i> مشاركة
149
+ </button>
150
+ </div>
151
+ </div>
152
+
153
+ <div id="emptyState" class="text-center py-12">
154
+ <i class="fas fa-image text-5xl text-gray-300 mb-4"></i>
155
+ <h3 class="text-xl font-semibold text-gray-500">لا توجد صورة معالجة</h3>
156
+ <p class="text-gray-400 mt-2">قم بتحميل صورة لرؤية النتيجة هنا</p>
157
+ </div>
158
+
159
+ <div id="loadingState" class="text-center py-12 hidden">
160
+ <div class="loading-spinner inline-block text-5xl text-blue-500 mb-4">
161
+ <i class="fas fa-spinner"></i>
162
+ </div>
163
+ <h3 class="text-xl font-semibold text-gray-700">جاري معالجة الصورة...</h3>
164
+ <p class="text-gray-500 mt-2">قد تستغرق العملية بضع ثوانٍ</p>
165
+ <div class="w-full bg-gray-200 rounded-full h-2.5 mt-4">
166
+ <div id="progressBar" class="bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ </div>
172
+
173
+ <!-- Features Section -->
174
+ <div class="mt-16">
175
+ <h2 class="text-2xl font-bold text-center mb-8 text-blue-800">لماذا تختار أداتنا؟</h2>
176
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
177
+ <div class="bg-white p-6 rounded-xl shadow-md">
178
+ <div class="text-blue-500 text-3xl mb-4">
179
+ <i class="fas fa-bolt"></i>
180
+ </div>
181
+ <h3 class="font-bold text-lg mb-2">سريعة وفعالة</h3>
182
+ <p class="text-gray-600">معالجة الصور في ثوانٍ باستخدام خوارزميات الذكاء الاصطناعي المتطورة</p>
183
+ </div>
184
+
185
+ <div class="bg-white p-6 rounded-xl shadow-md">
186
+ <div class="text-blue-500 text-3xl mb-4">
187
+ <i class="fas fa-lock"></i>
188
+ </div>
189
+ <h3 class="font-bold text-lg mb-2">خصوصية مضمونة</h3>
190
+ <p class="text-gray-600">صورك لا يتم تخزينها على خوادمنا، تتم المعالجة في متصفحك فقط</p>
191
+ </div>
192
+
193
+ <div class="bg-white p-6 rounded-xl shadow-md">
194
+ <div class="text-blue-500 text-3xl mb-4">
195
+ <i class="fas fa-crown"></i>
196
+ </div>
197
+ <h3 class="font-bold text-lg mb-2">نتائج احترافية</h3>
198
+ <p class="text-gray-600">إزالة دقيقة للخلفية مع الحفاظ على أدق التفاصيل في الصورة</p>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </div>
203
+
204
+ <!-- Footer -->
205
+ <footer class="bg-white py-6 mt-12 border-t">
206
+ <div class="container mx-auto px-4 text-center text-gray-500">
207
+ <p>© 2023 أداة إزالة الخلفية. جميع الحقوق محفوظة.</p>
208
+ <div class="flex justify-center space-x-4 mt-4">
209
+ <a href="#" class="hover:text-blue-600"><i class="fab fa-twitter"></i></a>
210
+ <a href="#" class="hover:text-blue-600"><i class="fab fa-facebook"></i></a>
211
+ <a href="#" class="hover:text-blue-600"><i class="fab fa-instagram"></i></a>
212
+ </div>
213
+ </div>
214
+ </footer>
215
+
216
+ <script>
217
+ document.addEventListener('DOMContentLoaded', function() {
218
+ const dropzone = document.getElementById('dropzone');
219
+ const fileInput = document.getElementById('fileInput');
220
+ const uploadBtn = document.getElementById('uploadBtn');
221
+ const beforeAfterContainer = document.getElementById('beforeAfterContainer');
222
+ const emptyState = document.getElementById('emptyState');
223
+ const loadingState = document.getElementById('loadingState');
224
+ const originalImage = document.getElementById('originalImage');
225
+ const processedImage = document.getElementById('processedImage');
226
+ const downloadBtn = document.getElementById('downloadBtn');
227
+ const newImageBtn = document.getElementById('newImageBtn');
228
+ const shareBtn = document.getElementById('shareBtn');
229
+ const progressBar = document.getElementById('progressBar');
230
+
231
+ // Prevent default drag behaviors
232
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
233
+ dropzone.addEventListener(eventName, preventDefaults, false);
234
+ document.body.addEventListener(eventName, preventDefaults, false);
235
+ });
236
+
237
+ // Highlight drop zone when item is dragged over it
238
+ ['dragenter', 'dragover'].forEach(eventName => {
239
+ dropzone.addEventListener(eventName, highlight, false);
240
+ });
241
+
242
+ ['dragleave', 'drop'].forEach(eventName => {
243
+ dropzone.addEventListener(eventName, unhighlight, false);
244
+ });
245
+
246
+ // Handle dropped files
247
+ dropzone.addEventListener('drop', handleDrop, false);
248
+
249
+ // Handle file selection via button
250
+ uploadBtn.addEventListener('click', () => fileInput.click());
251
+ fileInput.addEventListener('change', handleFiles);
252
+
253
+ // New image button
254
+ newImageBtn.addEventListener('click', resetTool);
255
+
256
+ function preventDefaults(e) {
257
+ e.preventDefault();
258
+ e.stopPropagation();
259
+ }
260
+
261
+ function highlight() {
262
+ dropzone.classList.add('active');
263
+ }
264
+
265
+ function unhighlight() {
266
+ dropzone.classList.remove('active');
267
+ }
268
+
269
+ function handleDrop(e) {
270
+ const dt = e.dataTransfer;
271
+ const files = dt.files;
272
+ handleFiles({ target: { files } });
273
+ }
274
+
275
+ function handleFiles(e) {
276
+ const files = e.target.files;
277
+ if (!files.length) return;
278
+
279
+ const file = files[0];
280
+ if (!file.type.match('image.*')) {
281
+ alert('الرجاء اختيار ملف صورة فقط');
282
+ return;
283
+ }
284
+
285
+ processImage(file);
286
+ }
287
+
288
+ function processImage(file) {
289
+ // Show loading state
290
+ emptyState.classList.add('hidden');
291
+ beforeAfterContainer.classList.add('hidden');
292
+ loadingState.classList.remove('hidden');
293
+
294
+ // Simulate processing (in a real app, you would use an API like Remove.bg)
295
+ simulateProcessing(file);
296
+ }
297
+
298
+ function simulateProcessing(file) {
299
+ // Update progress bar
300
+ let progress = 0;
301
+ const interval = setInterval(() => {
302
+ progress += 5;
303
+ progressBar.style.width = `${progress}%`;
304
+
305
+ if (progress >= 100) {
306
+ clearInterval(interval);
307
+ showResult(file);
308
+ }
309
+ }, 200);
310
+
311
+ // Create a preview of the original image
312
+ const reader = new FileReader();
313
+ reader.onload = function(e) {
314
+ originalImage.src = e.target.result;
315
+ };
316
+ reader.readAsDataURL(file);
317
+ }
318
+
319
+ function showResult(file) {
320
+ // In a real app, this would be the processed image from the API
321
+ // For demo, we'll just use the original image with a checkerboard background
322
+ const reader = new FileReader();
323
+ reader.onload = function(e) {
324
+ processedImage.src = e.target.result;
325
+
326
+ // Hide loading state and show result
327
+ loadingState.classList.add('hidden');
328
+ beforeAfterContainer.classList.remove('hidden');
329
+
330
+ // Auto download if enabled
331
+ if (document.getElementById('autoDownload').checked) {
332
+ downloadResult();
333
+ }
334
+ };
335
+ reader.readAsDataURL(file);
336
+ }
337
+
338
+ function downloadResult() {
339
+ // In a real app, this would download the processed image
340
+ // For demo, we'll create a download link for the original image
341
+ const link = document.createElement('a');
342
+ link.href = processedImage.src;
343
+ link.download = `صورة_بدون_خلفية.${document.getElementById('formatSelect').value}`;
344
+ document.body.appendChild(link);
345
+ link.click();
346
+ document.body.removeChild(link);
347
+ }
348
+
349
+ function resetTool() {
350
+ fileInput.value = '';
351
+ beforeAfterContainer.classList.add('hidden');
352
+ emptyState.classList.remove('hidden');
353
+ progressBar.style.width = '0%';
354
+ }
355
+
356
+ // Set up download button
357
+ downloadBtn.addEventListener('click', downloadResult);
358
+
359
+ // Set up share button
360
+ shareBtn.addEventListener('click', () => {
361
+ alert('في التطبيق الحقيقي، سيتم مشاركة الصورة المعالجة عبر منصات التواصل الاجتماعي');
362
+ });
363
+ });
364
+ </script>
365
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=yesok201/remove-back" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
366
+ </html>