ranga23127 commited on
Commit
8e68ddd
·
verified ·
1 Parent(s): 08a1c96

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +699 -19
  3. prompts.txt +6 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ranganewspacecircle
3
- emoji:
4
- colorFrom: pink
5
- colorTo: green
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: ranganewspacecircle
3
+ emoji: 🐳
4
+ colorFrom: blue
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,699 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Visual Search Tool</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
+ .canvas-container {
11
+ position: relative;
12
+ display: inline-block;
13
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
14
+ border-radius: 0.5rem;
15
+ overflow: hidden;
16
+ background-color: #f3f4f6;
17
+ }
18
+ #drawingCanvas {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ pointer-events: auto;
23
+ }
24
+ .selection-circle {
25
+ position: absolute;
26
+ border: 2px dashed #3B82F6;
27
+ border-radius: 50%;
28
+ background-color: rgba(59, 130, 246, 0.2);
29
+ cursor: pointer;
30
+ transition: all 0.2s;
31
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
32
+ }
33
+ .selection-circle:hover {
34
+ background-color: rgba(59, 130, 246, 0.3);
35
+ transform: scale(1.02);
36
+ }
37
+ .selection-circle.active {
38
+ border: 2px solid #EF4444;
39
+ background-color: rgba(239, 68, 68, 0.3);
40
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(239, 68, 68, 0.2);
41
+ }
42
+ #mediaElement {
43
+ max-width: 100%;
44
+ max-height: 80vh;
45
+ display: block;
46
+ }
47
+ .tooltip {
48
+ position: absolute;
49
+ background-color: rgba(0, 0, 0, 0.8);
50
+ color: white;
51
+ padding: 6px 12px;
52
+ border-radius: 6px;
53
+ font-size: 13px;
54
+ pointer-events: none;
55
+ z-index: 100;
56
+ white-space: nowrap;
57
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
58
+ transform: translateY(-10px);
59
+ opacity: 0;
60
+ transition: all 0.2s ease;
61
+ }
62
+ .tooltip.show {
63
+ transform: translateY(0);
64
+ opacity: 1;
65
+ }
66
+ .tooltip-arrow {
67
+ position: absolute;
68
+ width: 0;
69
+ height: 0;
70
+ border-left: 6px solid transparent;
71
+ border-right: 6px solid transparent;
72
+ border-top: 6px solid rgba(0, 0, 0, 0.8);
73
+ bottom: -6px;
74
+ left: 50%;
75
+ transform: translateX(-50%);
76
+ }
77
+ .loading-spinner {
78
+ display: inline-block;
79
+ width: 20px;
80
+ height: 20px;
81
+ border: 3px solid rgba(255,255,255,.3);
82
+ border-radius: 50%;
83
+ border-top-color: #fff;
84
+ animation: spin 1s ease-in-out infinite;
85
+ }
86
+ @keyframes spin {
87
+ to { transform: rotate(360deg); }
88
+ }
89
+ .search-results {
90
+ max-height: 300px;
91
+ overflow-y: auto;
92
+ scrollbar-width: thin;
93
+ scrollbar-color: #3B82F6 #f1f1f1;
94
+ }
95
+ .search-results::-webkit-scrollbar {
96
+ width: 8px;
97
+ }
98
+ .search-results::-webkit-scrollbar-track {
99
+ background: #f1f1f1;
100
+ border-radius: 10px;
101
+ }
102
+ .search-results::-webkit-scrollbar-thumb {
103
+ background-color: #3B82F6;
104
+ border-radius: 10px;
105
+ }
106
+ .result-item {
107
+ transition: all 0.2s;
108
+ }
109
+ .result-item:hover {
110
+ transform: translateY(-2px);
111
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
112
+ }
113
+ .search-tag {
114
+ display: inline-block;
115
+ background-color: #EFF6FF;
116
+ color: #1D4ED8;
117
+ padding: 2px 8px;
118
+ border-radius: 9999px;
119
+ font-size: 12px;
120
+ margin-right: 4px;
121
+ margin-bottom: 4px;
122
+ }
123
+ </style>
124
+ </head>
125
+ <body class="bg-gray-100 min-h-screen">
126
+ <div class="container mx-auto px-4 py-8">
127
+ <div class="text-center mb-8">
128
+ <h1 class="text-3xl font-bold text-blue-600 mb-2">Visual Search Tool</h1>
129
+ <p class="text-gray-600">Draw circles around objects to find similar items online</p>
130
+ </div>
131
+
132
+ <div class="bg-white rounded-lg shadow-lg p-6 mb-8">
133
+ <div class="flex flex-wrap gap-4 mb-6">
134
+ <div class="flex-1">
135
+ <label class="block text-sm font-medium text-gray-700 mb-1">Media Source</label>
136
+ <div class="flex gap-2">
137
+ <select id="mediaType" class="flex-1 rounded-md border border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 p-2">
138
+ <option value="image">Image</option>
139
+ <option value="video">Video</option>
140
+ </select>
141
+ <input type="file" id="fileInput" accept="image/*,video/*" class="hidden">
142
+ <button id="uploadBtn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md transition flex items-center">
143
+ <i class="fas fa-upload mr-2"></i>Upload
144
+ </button>
145
+ </div>
146
+ </div>
147
+ <div class="flex-1">
148
+ <label class="block text-sm font-medium text-gray-700 mb-1">Or use sample</label>
149
+ <select id="sampleSelect" class="w-full rounded-md border border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 p-2">
150
+ <option value="">Select a sample...</option>
151
+ <option value="https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=800">Food Sample</option>
152
+ <option value="https://images.unsplash.com/photo-1526170375885-4d8ecf77b99f?w=800">Electronics Sample</option>
153
+ <option value="https://images.unsplash.com/photo-1551963831-b3b1ca40c98e?w=800">Flower Sample</option>
154
+ <option value="https://images.unsplash.com/photo-1489987707025-afc232f7ea0f?w=800">Clothing Sample</option>
155
+ </select>
156
+ </div>
157
+ </div>
158
+
159
+ <div class="flex justify-center mb-4">
160
+ <div class="canvas-container">
161
+ <img id="mediaElement" src="" alt="Selected media" class="hidden">
162
+ <video id="videoElement" controls class="hidden"></video>
163
+ <canvas id="drawingCanvas"></canvas>
164
+ <div id="circlesContainer"></div>
165
+ <div id="noMediaPlaceholder" class="flex flex-col items-center justify-center p-8 w-full h-64 text-gray-400">
166
+ <i class="fas fa-image text-4xl mb-4"></i>
167
+ <p>Upload an image or select a sample to begin</p>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <div class="mt-6 flex flex-wrap justify-center gap-4">
173
+ <button id="clearBtn" class="bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded-md transition disabled:opacity-50 disabled:cursor-not-allowed" disabled>
174
+ <i class="fas fa-trash-alt mr-2"></i>Clear Circles
175
+ </button>
176
+ <button id="searchBtn" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-md transition disabled:opacity-50 disabled:cursor-not-allowed" disabled>
177
+ <i class="fas fa-search mr-2"></i>Search Selected
178
+ </button>
179
+ <button id="helpBtn" class="bg-purple-500 hover:bg-purple-600 text-white px-4 py-2 rounded-md transition">
180
+ <i class="fas fa-question-circle mr-2"></i>Help
181
+ </button>
182
+ </div>
183
+ </div>
184
+
185
+ <div id="resultsContainer" class="bg-white rounded-lg shadow-lg p-6 hidden">
186
+ <div class="flex justify-between items-center mb-4">
187
+ <h2 class="text-xl font-bold text-gray-800">Search Results</h2>
188
+ <div id="searchTags" class="flex flex-wrap">
189
+ <!-- Search tags will appear here -->
190
+ </div>
191
+ </div>
192
+ <div id="searchResults" class="search-results grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
193
+ <!-- Results will be inserted here -->
194
+ </div>
195
+ </div>
196
+
197
+ <div id="helpModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
198
+ <div class="bg-white rounded-lg p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto">
199
+ <div class="flex justify-between items-center mb-4">
200
+ <h3 class="text-xl font-bold text-gray-800">How to use the Visual Search Tool</h3>
201
+ <button id="closeHelpModal" class="text-gray-500 hover:text-gray-700">
202
+ <i class="fas fa-times"></i>
203
+ </button>
204
+ </div>
205
+ <div class="space-y-4 text-gray-700">
206
+ <div class="flex items-start gap-3">
207
+ <div class="bg-blue-100 text-blue-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0">
208
+ <i class="fas fa-upload"></i>
209
+ </div>
210
+ <div>
211
+ <h4 class="font-semibold">Upload Media</h4>
212
+ <p>Click the "Upload" button to select an image or video from your device, or choose from our sample images.</p>
213
+ </div>
214
+ </div>
215
+ <div class="flex items-start gap-3">
216
+ <div class="bg-blue-100 text-blue-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0">
217
+ <i class="fas fa-mouse-pointer"></i>
218
+ </div>
219
+ <div>
220
+ <h4 class="font-semibold">Draw Circles</h4>
221
+ <p>Click and drag on the image to draw circles around objects you want to search for. You can create multiple circles.</p>
222
+ </div>
223
+ </div>
224
+ <div class="flex items-start gap-3">
225
+ <div class="bg-blue-100 text-blue-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0">
226
+ <i class="fas fa-search"></i>
227
+ </div>
228
+ <div>
229
+ <h4 class="font-semibold">Search Objects</h4>
230
+ <p>Click on a circle to select it (it will turn red), then click "Search Selected" to find similar items online.</p>
231
+ </div>
232
+ </div>
233
+ <div class="flex items-start gap-3">
234
+ <div class="bg-blue-100 text-blue-800 rounded-full w-8 h-8 flex items-center justify-center flex-shrink-0">
235
+ <i class="fas fa-trash-alt"></i>
236
+ </div>
237
+ <div>
238
+ <h4 class="font-semibold">Clear Circles</h4>
239
+ <p>Use the "Clear Circles" button to remove all circles from your image and start fresh.</p>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </div>
245
+
246
+ <div id="loadingModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
247
+ <div class="bg-white rounded-lg p-6 max-w-sm w-full text-center">
248
+ <div class="flex justify-center mb-4">
249
+ <div class="loading-spinner"></div>
250
+ </div>
251
+ <p class="text-gray-700">Searching for similar items...</p>
252
+ <p class="text-sm text-gray-500 mt-2">(Simulating Google Search API)</p>
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+ <script>
258
+ document.addEventListener('DOMContentLoaded', function() {
259
+ // DOM elements
260
+ const mediaElement = document.getElementById('mediaElement');
261
+ const videoElement = document.getElementById('videoElement');
262
+ const drawingCanvas = document.getElementById('drawingCanvas');
263
+ const ctx = drawingCanvas.getContext('2d');
264
+ const circlesContainer = document.getElementById('circlesContainer');
265
+ const noMediaPlaceholder = document.getElementById('noMediaPlaceholder');
266
+ const fileInput = document.getElementById('fileInput');
267
+ const uploadBtn = document.getElementById('uploadBtn');
268
+ const mediaType = document.getElementById('mediaType');
269
+ const sampleSelect = document.getElementById('sampleSelect');
270
+ const clearBtn = document.getElementById('clearBtn');
271
+ const searchBtn = document.getElementById('searchBtn');
272
+ const helpBtn = document.getElementById('helpBtn');
273
+ const helpModal = document.getElementById('helpModal');
274
+ const closeHelpModal = document.getElementById('closeHelpModal');
275
+ const loadingModal = document.getElementById('loadingModal');
276
+ const resultsContainer = document.getElementById('resultsContainer');
277
+ const searchResults = document.getElementById('searchResults');
278
+ const searchTags = document.getElementById('searchTags');
279
+
280
+ // State variables
281
+ let isDrawing = false;
282
+ let startX, startY;
283
+ let circles = [];
284
+ let selectedCircleIndex = -1;
285
+ let currentMediaType = 'image';
286
+ let currentMediaUrl = '';
287
+ let currentMediaWidth = 0;
288
+ let currentMediaHeight = 0;
289
+
290
+ // Event listeners
291
+ uploadBtn.addEventListener('click', () => fileInput.click());
292
+ fileInput.addEventListener('change', handleFileUpload);
293
+ mediaType.addEventListener('change', handleMediaTypeChange);
294
+ sampleSelect.addEventListener('change', handleSampleSelect);
295
+ clearBtn.addEventListener('click', clearCircles);
296
+ searchBtn.addEventListener('click', searchSelectedCircle);
297
+ helpBtn.addEventListener('click', () => helpModal.classList.remove('hidden'));
298
+ closeHelpModal.addEventListener('click', () => helpModal.classList.add('hidden'));
299
+ helpModal.addEventListener('click', (e) => {
300
+ if (e.target === helpModal) helpModal.classList.add('hidden');
301
+ });
302
+
303
+ // Drawing events
304
+ drawingCanvas.addEventListener('mousedown', startDrawing);
305
+ drawingCanvas.addEventListener('mousemove', drawCircle);
306
+ drawingCanvas.addEventListener('mouseup', endDrawing);
307
+ drawingCanvas.addEventListener('mouseleave', endDrawing);
308
+
309
+ // Handle file upload
310
+ function handleFileUpload(e) {
311
+ const file = e.target.files[0];
312
+ if (!file) return;
313
+
314
+ currentMediaType = file.type.startsWith('video/') ? 'video' : 'image';
315
+ mediaType.value = currentMediaType;
316
+
317
+ const url = URL.createObjectURL(file);
318
+ loadMedia(url);
319
+ }
320
+
321
+ // Handle media type change
322
+ function handleMediaTypeChange() {
323
+ currentMediaType = mediaType.value;
324
+ if (currentMediaUrl) {
325
+ loadMedia(currentMediaUrl);
326
+ }
327
+ }
328
+
329
+ // Handle sample selection
330
+ function handleSampleSelect(e) {
331
+ const url = e.target.value;
332
+ if (!url) return;
333
+
334
+ currentMediaType = 'image'; // All samples are images
335
+ mediaType.value = currentMediaType;
336
+
337
+ loadMedia(url);
338
+ }
339
+
340
+ // Load media (image or video)
341
+ function loadMedia(url) {
342
+ currentMediaUrl = url;
343
+ clearCircles();
344
+
345
+ if (currentMediaType === 'image') {
346
+ mediaElement.src = url;
347
+ mediaElement.classList.remove('hidden');
348
+ videoElement.classList.add('hidden');
349
+ videoElement.pause();
350
+ noMediaPlaceholder.classList.add('hidden');
351
+
352
+ mediaElement.onload = function() {
353
+ setupCanvas(mediaElement);
354
+ };
355
+ } else {
356
+ videoElement.src = url;
357
+ videoElement.classList.remove('hidden');
358
+ mediaElement.classList.add('hidden');
359
+ noMediaPlaceholder.classList.add('hidden');
360
+
361
+ videoElement.onloadedmetadata = function() {
362
+ setupCanvas(videoElement);
363
+ };
364
+ }
365
+
366
+ // Enable buttons
367
+ clearBtn.disabled = false;
368
+ resultsContainer.classList.add('hidden');
369
+ }
370
+
371
+ // Setup canvas dimensions
372
+ function setupCanvas(media) {
373
+ const container = media.parentElement;
374
+ const width = media.clientWidth;
375
+ const height = media.clientHeight;
376
+
377
+ currentMediaWidth = width;
378
+ currentMediaHeight = height;
379
+
380
+ drawingCanvas.width = width;
381
+ drawingCanvas.height = height;
382
+ drawingCanvas.style.width = width + 'px';
383
+ drawingCanvas.style.height = height + 'px';
384
+
385
+ // Clear any existing drawings
386
+ ctx.clearRect(0, 0, width, height);
387
+ }
388
+
389
+ // Drawing functions
390
+ function startDrawing(e) {
391
+ if (!currentMediaUrl) return;
392
+
393
+ isDrawing = true;
394
+ const rect = drawingCanvas.getBoundingClientRect();
395
+ startX = e.clientX - rect.left;
396
+ startY = e.clientY - rect.top;
397
+ }
398
+
399
+ function drawCircle(e) {
400
+ if (!isDrawing) return;
401
+
402
+ const rect = drawingCanvas.getBoundingClientRect();
403
+ const currentX = e.clientX - rect.left;
404
+ const currentY = e.clientY - rect.top;
405
+
406
+ // Calculate radius
407
+ const radius = Math.sqrt(
408
+ Math.pow(currentX - startX, 2) +
409
+ Math.pow(currentY - startY, 2)
410
+ );
411
+
412
+ // Clear canvas and redraw
413
+ ctx.clearRect(0, 0, drawingCanvas.width, drawingCanvas.height);
414
+ ctx.beginPath();
415
+ ctx.arc(startX, startY, radius, 0, 2 * Math.PI);
416
+ ctx.strokeStyle = '#3B82F6';
417
+ ctx.lineWidth = 2;
418
+ ctx.stroke();
419
+ ctx.fillStyle = 'rgba(59, 130, 246, 0.2)';
420
+ ctx.fill();
421
+ }
422
+
423
+ function endDrawing(e) {
424
+ if (!isDrawing) return;
425
+ isDrawing = false;
426
+
427
+ const rect = drawingCanvas.getBoundingClientRect();
428
+ const endX = e.clientX - rect.left;
429
+ const endY = e.clientY - rect.top;
430
+
431
+ // Calculate radius
432
+ const radius = Math.sqrt(
433
+ Math.pow(endX - startX, 2) +
434
+ Math.pow(endY - startY, 2)
435
+ );
436
+
437
+ // Only create circle if radius is at least 10px
438
+ if (radius >= 10) {
439
+ createCircle(startX, startY, radius);
440
+ }
441
+
442
+ // Clear temporary drawing
443
+ ctx.clearRect(0, 0, drawingCanvas.width, drawingCanvas.height);
444
+ }
445
+
446
+ // Create a circle element
447
+ function createCircle(x, y, radius) {
448
+ const circle = document.createElement('div');
449
+ circle.className = 'selection-circle';
450
+ circle.style.left = (x - radius) + 'px';
451
+ circle.style.top = (y - radius) + 'px';
452
+ circle.style.width = (radius * 2) + 'px';
453
+ circle.style.height = (radius * 2) + 'px';
454
+
455
+ // Store circle data
456
+ const circleData = { x, y, radius, element: circle };
457
+ const index = circles.length;
458
+ circles.push(circleData);
459
+
460
+ // Add click event to select circle
461
+ circle.addEventListener('click', (e) => {
462
+ e.stopPropagation();
463
+ selectCircle(index);
464
+ });
465
+
466
+ // Add hover tooltip
467
+ const tooltip = document.createElement('div');
468
+ tooltip.className = 'tooltip';
469
+
470
+ const tooltipContent = document.createElement('div');
471
+ tooltipContent.textContent = `Click to select (${Math.round(radius)}px)`;
472
+ tooltip.appendChild(tooltipContent);
473
+
474
+ const tooltipArrow = document.createElement('div');
475
+ tooltipArrow.className = 'tooltip-arrow';
476
+ tooltip.appendChild(tooltipArrow);
477
+
478
+ circle.addEventListener('mouseenter', () => {
479
+ tooltip.style.left = (x - radius) + 'px';
480
+ tooltip.style.top = (y - radius - 40) + 'px';
481
+ circlesContainer.appendChild(tooltip);
482
+ setTimeout(() => tooltip.classList.add('show'), 10);
483
+ });
484
+
485
+ circle.addEventListener('mouseleave', () => {
486
+ tooltip.classList.remove('show');
487
+ setTimeout(() => {
488
+ if (tooltip.parentNode) {
489
+ tooltip.parentNode.removeChild(tooltip);
490
+ }
491
+ }, 200);
492
+ });
493
+
494
+ circlesContainer.appendChild(circle);
495
+ searchBtn.disabled = false;
496
+ clearBtn.disabled = false;
497
+ }
498
+
499
+ // Select a circle
500
+ function selectCircle(index) {
501
+ // Deselect previous circle
502
+ if (selectedCircleIndex >= 0) {
503
+ circles[selectedCircleIndex].element.classList.remove('active');
504
+ }
505
+
506
+ // Select new circle
507
+ selectedCircleIndex = index;
508
+ circles[index].element.classList.add('active');
509
+
510
+ // Enable search button
511
+ searchBtn.disabled = false;
512
+ }
513
+
514
+ // Clear all circles
515
+ function clearCircles() {
516
+ circlesContainer.innerHTML = '';
517
+ circles = [];
518
+ selectedCircleIndex = -1;
519
+ searchBtn.disabled = true;
520
+ clearBtn.disabled = circles.length === 0;
521
+ resultsContainer.classList.add('hidden');
522
+
523
+ if (!currentMediaUrl) {
524
+ noMediaPlaceholder.classList.remove('hidden');
525
+ }
526
+ }
527
+
528
+ // Search for selected circle (simulated)
529
+ function searchSelectedCircle() {
530
+ if (selectedCircleIndex < 0 || !currentMediaUrl) return;
531
+
532
+ const circle = circles[selectedCircleIndex];
533
+
534
+ // Show loading modal
535
+ loadingModal.classList.remove('hidden');
536
+
537
+ // Simulate API call with timeout
538
+ setTimeout(() => {
539
+ loadingModal.classList.add('hidden');
540
+ showSearchResults(circle);
541
+ }, 1500);
542
+ }
543
+
544
+ // Show search results (simulated)
545
+ function showSearchResults(circle) {
546
+ resultsContainer.classList.remove('hidden');
547
+ searchResults.innerHTML = '';
548
+ searchTags.innerHTML = '';
549
+
550
+ // Generate search tags based on sample selected
551
+ let tags = [];
552
+ const sampleText = sampleSelect.options[sampleSelect.selectedIndex].text;
553
+
554
+ if (sampleText.includes('Food')) {
555
+ tags = ['food', 'meal', 'delicious', 'recipe', 'cooking', 'breakfast', 'healthy', 'nutrition'];
556
+ } else if (sampleText.includes('Electronics')) {
557
+ tags = ['electronics', 'camera', 'photography', 'tech', 'gadget', 'digital', 'lens', 'accessories'];
558
+ } else if (sampleText.includes('Flower')) {
559
+ tags = ['flower', 'floral', 'bouquet', 'garden', 'bloom', 'nature', 'plant', 'arrangement'];
560
+ } else if (sampleText.includes('Clothing')) {
561
+ tags = ['clothing', 'fashion', 'apparel', 'style', 'wear', 'jacket', 'outfit', 'casual'];
562
+ } else {
563
+ tags = ['object', 'item', 'visual', 'search', 'similar', 'product', 'shopping', 'online'];
564
+ }
565
+
566
+ // Add search tags
567
+ tags.forEach(tag => {
568
+ const tagElement = document.createElement('span');
569
+ tagElement.className = 'search-tag';
570
+ tagElement.textContent = tag;
571
+ searchTags.appendChild(tagElement);
572
+ });
573
+
574
+ // Generate mock results that simulate Google search results
575
+ const mockResults = generateMockResults(sampleText);
576
+
577
+ // Display results
578
+ mockResults.forEach(result => {
579
+ const resultItem = document.createElement('div');
580
+ resultItem.className = 'result-item bg-gray-50 rounded-lg overflow-hidden hover:shadow-md transition';
581
+
582
+ const imgContainer = document.createElement('div');
583
+ imgContainer.className = 'relative overflow-hidden h-40';
584
+
585
+ const img = document.createElement('img');
586
+ img.src = result.url;
587
+ img.alt = result.title;
588
+ img.className = 'w-full h-full object-cover';
589
+
590
+ const priceTag = document.createElement('div');
591
+ priceTag.className = 'absolute bottom-2 right-2 bg-white px-2 py-1 rounded text-sm font-medium text-gray-800 shadow-sm';
592
+ priceTag.textContent = result.price;
593
+
594
+ imgContainer.appendChild(img);
595
+ imgContainer.appendChild(priceTag);
596
+
597
+ const infoContainer = document.createElement('div');
598
+ infoContainer.className = 'p-3';
599
+
600
+ const title = document.createElement('h3');
601
+ title.className = 'text-sm font-medium text-gray-800 mb-1 truncate';
602
+ title.textContent = result.title;
603
+
604
+ const source = document.createElement('p');
605
+ source.className = 'text-xs text-gray-500 mb-2';
606
+ source.textContent = result.source;
607
+
608
+ const rating = document.createElement('div');
609
+ rating.className = 'flex items-center text-xs text-yellow-500 mb-1';
610
+
611
+ for (let i = 0; i < 5; i++) {
612
+ const star = document.createElement('i');
613
+ star.className = i < Math.floor(result.rating) ? 'fas fa-star' : 'far fa-star';
614
+ rating.appendChild(star);
615
+ }
616
+
617
+ const ratingCount = document.createElement('span');
618
+ ratingCount.className = 'text-gray-500 ml-1';
619
+ ratingCount.textContent = `(${result.reviews})`;
620
+ rating.appendChild(ratingCount);
621
+
622
+ infoContainer.appendChild(title);
623
+ infoContainer.appendChild(source);
624
+ infoContainer.appendChild(rating);
625
+
626
+ resultItem.appendChild(imgContainer);
627
+ resultItem.appendChild(infoContainer);
628
+
629
+ searchResults.appendChild(resultItem);
630
+ });
631
+
632
+ // Scroll to results
633
+ resultsContainer.scrollIntoView({ behavior: 'smooth' });
634
+ }
635
+
636
+ // Generate mock search results based on sample type
637
+ function generateMockResults(sampleText) {
638
+ if (sampleText.includes('Food')) {
639
+ return [
640
+ { url: 'https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=300', title: 'Delicious Breakfast Platter', source: 'foodnetwork.com', price: '$12.99', rating: 4.5, reviews: 128 },
641
+ { url: 'https://images.unsplash.com/photo-1565958011703-44f9829ba187?w=300', title: 'Healthy Meal Prep Containers', source: 'mealprep.com', price: '$9.99', rating: 4.2, reviews: 87 },
642
+ { url: 'https://images.unsplash.com/photo-1482049016688-2d3e1b311543?w=300', title: 'Avocado Toast with Eggs', source: 'brunchrecipes.com', price: '$8.49', rating: 4.7, reviews: 215 },
643
+ { url: 'https://images.unsplash.com/photo-1484723091739-30a097e8f929?w=300', title: 'Fresh Fruit Breakfast Bowl', source: 'healthyfood.com', price: '$7.99', rating: 4.8, reviews: 342 },
644
+ { url: 'https://images.unsplash.com/photo-1490645935967-10de6ba17061?w=300', title: 'Pancakes with Berries', source: 'breakfastrecipes.com', price: '$10.99', rating: 4.3, reviews: 176 },
645
+ { url: 'https://images.unsplash.com/photo-1504754524776-8f4f37790c62?w=300', title: 'Homemade Pasta Ingredients', source: 'italianfood.com', price: '$15.99', rating: 4.6, reviews: 92 },
646
+ { url: 'https://images.unsplash.com/photo-1490645935967-10de6ba17061?w=300', title: 'Acai Breakfast Bowl', source: 'superfoods.com', price: '$11.49', rating: 4.9, reviews: 287 },
647
+ { url: 'https://images.unsplash.com/photo-1546069901-d5bfd2cbfb1f?w=300', title: 'Colorful Salad Ingredients', source: 'saladrecipes.com', price: '$6.99', rating: 4.1, reviews: 53 }
648
+ ];
649
+ } else if (sampleText.includes('Electronics')) {
650
+ return [
651
+ { url: 'https://images.unsplash.com/photo-1526170375885-4d8ecf77b99f?w=300', title: 'Vintage Camera Collection', source: 'vintagecameras.com', price: '$249.99', rating: 4.8, reviews: 342 },
652
+ { url: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=300', title: '4K Digital Camera', source: 'techgadgets.com', price: '$399.99', rating: 4.6, reviews: 215 },
653
+ { url: 'https://images.unsplash.com/photo-1518770660439-4636190af475?w=300', title: 'Professional DSLR', source: 'photographypro.com', price: '$899.99', rating: 4.9, reviews: 487 },
654
+ { url: 'https://images.unsplash.com/photo-1512790182412-b19e6d62bc39?w=300', title: 'Mirrorless Camera Body', source: 'mirrorlesscam.com', price: '$749.99', rating: 4.7, reviews: 328 },
655
+ { url: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=300', title: 'Compact Travel Camera', source: 'travelgear.com', price: '$299.99', rating: 4.4, reviews: 176 },
656
+ { url: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=300', title: 'Action Camera Bundle', source: 'adventuretech.com', price: '$349.99', rating: 4.5, reviews: 243 },
657
+ { url: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=300', title: 'Polaroid Instant Camera', source: 'instantphotos.com', price: '$129.99', rating: 4.2, reviews: 187 },
658
+ { url: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=300', title: 'Film Camera Starter Kit', source: 'filmphotography.com', price: '$199.99', rating: 4.7, reviews: 156 }
659
+ ];
660
+ } else if (sampleText.includes('Flower')) {
661
+ return [
662
+ { url: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e?w=300', title: 'Fresh Cut Flowers Bouquet', source: 'florist.com', price: '$29.99', rating: 4.8, reviews: 432 },
663
+ { url: 'https://images.unsplash.com/photo-1521012012373-6a85fade14b3?w=300', title: 'Rose Flower Arrangement', source: 'rosegarden.com', price: '$39.99', rating: 4.9, reviews: 387 },
664
+ { url: 'https://images.unsplash.com/photo-1490750967868-88aa4486c946?w=300', title: 'Sunflower Bouquet', source: 'sunflowershop.com', price: '$24.99', rating: 4.7, reviews: 215 },
665
+ { url: 'https://images.unsplash.com/photo-1455659817273-68adca893fe3?w=300', title: 'Tulip Flower Bunch', source: 'tulipfarm.com', price: '$19.99', rating: 4.6, reviews: 176 },
666
+ { url: 'https://images.unsplash.com/photo-1455659817273-68adca893fe3?w=300', title: 'Orchid Plant in Pot', source: 'orchidlovers.com', price: '$34.99', rating: 4.8, reviews: 243 },
667
+ { url: 'https://images.unsplash.com/photo-1455659817273-68adca893fe3?w=300', title: 'Lily Flower Arrangement', source: 'lilygarden.com', price: '$27.99', rating: 4.5, reviews: 128 },
668
+ { url: 'https://images.unsplash.com/photo-1455659817273-68adca893fe3?w=300', title: 'Wildflower Seed Mix', source: 'gardensupply.com', price: '$14.99', rating: 4.4, reviews: 342 },
669
+ { url: 'https://images.unsplash.com/photo-1455659817273-68adca893fe3?w=300', title: 'Daisy Flower Crown', source: 'flowercrowns.com', price: '$22.99', rating: 4.7, reviews: 187 }
670
+ ];
671
+ } else if (sampleText.includes('Clothing')) {
672
+ return [
673
+ { url: 'https://images.unsplash.com/photo-1489987707025-afc232f7ea0f?w=300', title: 'Denim Jacket - Blue', source: 'denimwear.com', price: '$59.99', rating: 4.6, reviews: 342 },
674
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Casual T-Shirt - White', source: 'basicshirts.com', price: '$19.99', rating: 4.3, reviews: 215 },
675
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Summer Dress - Floral', source: 'summerfashion.com', price: '$39.99', rating: 4.7, reviews: 487 },
676
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Wool Sweater - Grey', source: 'knitwear.com', price: '$49.99', rating: 4.5, reviews: 176 },
677
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Leather Jacket - Black', source: 'leathergoods.com', price: '$129.99', rating: 4.8, reviews: 328 },
678
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Cotton Pants - Khaki', source: 'casualwear.com', price: '$34.99', rating: 4.4, reviews: 243 },
679
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Silk Scarf - Patterned', source: 'accessories.com', price: '$24.99', rating: 4.6, reviews: 156 },
680
+ { url: 'https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?w=300', title: 'Winter Coat - Navy', source: 'outerwear.com', price: '$89.99', rating: 4.7, reviews: 432 }
681
+ ];
682
+ } else {
683
+ // Default results
684
+ return [
685
+ { url: 'https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=300', title: 'Sample Item 1', source: 'example.com', price: '$19.99', rating: 4.0, reviews: 42 },
686
+ { url: 'https://images.unsplash.com/photo-1565958011703-44f9829ba187?w=300', title: 'Sample Item 2', source: 'example.com', price: '$29.99', rating: 4.2, reviews: 37 },
687
+ { url: 'https://images.unsplash.com/photo-1482049016688-2d3e1b311543?w=300', title: 'Sample Item 3', source: 'example.com', price: '$14.99', rating: 3.8, reviews: 28 },
688
+ { url: 'https://images.unsplash.com/photo-1484723091739-30a097e8f929?w=300', title: 'Sample Item 4', source: 'example.com', price: '$24.99', rating: 4.5, reviews: 53 },
689
+ { url: 'https://images.unsplash.com/photo-1490645935967-10de6ba17061?w=300', title: 'Sample Item 5', source: 'example.com', price: '$34.99', rating: 4.1, reviews: 46 },
690
+ { url: 'https://images.unsplash.com/photo-1504754524776-8f4f37790c62?w=300', title: 'Sample Item 6', source: 'example.com', price: '$9.99', rating: 3.9, reviews: 31 },
691
+ { url: 'https://images.unsplash.com/photo-1490645935967-10de6ba17061?w=300', title: 'Sample Item 7', source: 'example.com', price: '$19.99', rating: 4.3, reviews: 62 },
692
+ { url: 'https://images.unsplash.com/photo-1546069901-d5bfd2cbfb1f?w=300', title: 'Sample Item 8', source: 'example.com', price: '$12.99', rating: 4.0, reviews: 39 }
693
+ ];
694
+ }
695
+ }
696
+ });
697
+ </script>
698
+ <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=ranga23127/ranganewspacecircle" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
699
+ </html>
prompts.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ User will draw a circle on any image or video and it will navigate to google and show the similar results.
2
+ circle is not there
3
+ This functionality can be achieved using a combination of image/video processing libraries (like OpenCV) and a search engine API (like Google Images or Google Lens). The user would interact with an application that allows them to draw a circle on an image or video frame, and then the application would: 1. Extract the region within the circle: Use image processing techniques to isolate the region of the image or video frame defined by the circle. 2. Process the image/video: Potentially use techniques like object detection, image recognition, or feature extraction to create a representation of the region within the circle. 3. Make a search query: Use a search engine API to search for similar results based on the processed region. 4. Display the search results: The application would then display the search results to the user, potentially within the same application or by navigating to the search engine's website. Here's a breakdown of how the application could work: 1. Drawing and Region Extraction: The application would use a UI library (like Flutter, React, or a native UI library) to display the image or video frame. A drawing tool would allow the user to draw a circle on the image or video frame. The application would then use image processing libraries like OpenCV (in Python, Java, or C++) to extract the region within the circle. This involves determining the circle's center and radius and cropping or masking the image to isolate that area. 2. Processing the Image/Video: Object Detection/Recognition: If the goal is to find similar objects, you'd use an object detection model (like TensorFlow or PyTorch with a pre-trained model) to identify the objects within the extracted region. Feature Extraction: If the goal is to find visually similar images, you'd use techniques like feature extraction (e.g., using a CNN) to create a vector representation of the region. 3. Search Query: The application would use a search engine API (like Google Image Search API, or Google Lens API) to search for similar results. Based on the processed region, the API would be queried with a description (e.g., "objects detected" or "image features"). 4. Displaying Results: The search results would be displayed within the application, or the user would be navigated to the search engine's website to see the results.
4
+ here the circle is not showing and i dont how to draw to search in google
5
+ circle is there but gooogle api is not there to run here. make
6
+ flower sample is wrongly like food appearing. cloths sample are not showing. change these things, its not predicting correctly or not detecting so see and make correctly