Spaces:
Running
Running
Add 2 files
Browse files- README.md +6 -4
- index.html +164 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: red
|
| 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: vectorizer
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
colorTo: red
|
| 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,164 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Image to SVG Vectorizer</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 |
+
.dropzone {
|
| 11 |
+
border: 2px dashed #cbd5e0;
|
| 12 |
+
transition: all 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
.dropzone.active {
|
| 15 |
+
border-color: #4f46e5;
|
| 16 |
+
background-color: #eef2ff;
|
| 17 |
+
}
|
| 18 |
+
.progress-bar {
|
| 19 |
+
transition: width 0.3s ease;
|
| 20 |
+
}
|
| 21 |
+
#svgPreview {
|
| 22 |
+
max-height: 400px;
|
| 23 |
+
overflow: auto;
|
| 24 |
+
background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
|
| 25 |
+
linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
|
| 26 |
+
linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
|
| 27 |
+
linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
|
| 28 |
+
background-size: 20px 20px;
|
| 29 |
+
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
|
| 30 |
+
}
|
| 31 |
+
.tooltip {
|
| 32 |
+
position: relative;
|
| 33 |
+
}
|
| 34 |
+
.tooltip-text {
|
| 35 |
+
visibility: hidden;
|
| 36 |
+
width: 200px;
|
| 37 |
+
background-color: #333;
|
| 38 |
+
color: #fff;
|
| 39 |
+
text-align: center;
|
| 40 |
+
border-radius: 6px;
|
| 41 |
+
padding: 5px;
|
| 42 |
+
position: absolute;
|
| 43 |
+
z-index: 1;
|
| 44 |
+
bottom: 125%;
|
| 45 |
+
left: 50%;
|
| 46 |
+
transform: translateX(-50%);
|
| 47 |
+
opacity: 0;
|
| 48 |
+
transition: opacity 0.3s;
|
| 49 |
+
}
|
| 50 |
+
.tooltip:hover .tooltip-text {
|
| 51 |
+
visibility: visible;
|
| 52 |
+
opacity: 1;
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
</head>
|
| 56 |
+
<body class="bg-gray-50 min-h-screen">
|
| 57 |
+
<div class="container mx-auto px-4 py-8">
|
| 58 |
+
<header class="text-center mb-12">
|
| 59 |
+
<h1 class="text-4xl font-bold text-indigo-600 mb-2">
|
| 60 |
+
<i class="fas fa-vector-square mr-2"></i>Image to SVG Vectorizer
|
| 61 |
+
</h1>
|
| 62 |
+
<p class="text-gray-600 max-w-2xl mx-auto">
|
| 63 |
+
Convert your raster images (JPG, PNG, etc.) into scalable vector graphics (SVG) with customizable settings
|
| 64 |
+
</p>
|
| 65 |
+
</header>
|
| 66 |
+
|
| 67 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden max-w-4xl mx-auto">
|
| 68 |
+
<div class="md:flex">
|
| 69 |
+
<!-- Left Panel - Upload and Settings -->
|
| 70 |
+
<div class="p-6 md:w-1/2 border-r border-gray-200">
|
| 71 |
+
<div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6">
|
| 72 |
+
<div class="flex flex-col items-center justify-center">
|
| 73 |
+
<i class="fas fa-cloud-upload-alt text-4xl text-indigo-500 mb-3"></i>
|
| 74 |
+
<h3 class="text-lg font-medium text-gray-700 mb-1">Drag & Drop your image here</h3>
|
| 75 |
+
<p class="text-gray-500 text-sm mb-3">or click to browse files</p>
|
| 76 |
+
<input type="file" id="fileInput" class="hidden" accept="image/*">
|
| 77 |
+
<button id="browseBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md text-sm font-medium transition">
|
| 78 |
+
Select Image
|
| 79 |
+
</button>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div id="previewContainer" class="hidden mb-6">
|
| 84 |
+
<h3 class="text-lg font-medium text-gray-700 mb-3">Image Preview</h3>
|
| 85 |
+
<div class="relative">
|
| 86 |
+
<img id="imagePreview" class="max-h-48 w-auto mx-auto rounded-md shadow-sm border border-gray-200">
|
| 87 |
+
<button id="removeImage" class="absolute top-2 right-2 bg-red-500 hover:bg-red-600 text-white rounded-full p-1">
|
| 88 |
+
<i class="fas fa-times text-xs"></i>
|
| 89 |
+
</button>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<div class="space-y-4">
|
| 94 |
+
<h3 class="text-lg font-medium text-gray-700">Vectorization Settings</h3>
|
| 95 |
+
|
| 96 |
+
<div>
|
| 97 |
+
<label for="colorPrecision" class="block text-sm font-medium text-gray-700 mb-1">Color Precision</label>
|
| 98 |
+
<select id="colorPrecision" class="w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm">
|
| 99 |
+
<option value="1">Low (fewer colors)</option>
|
| 100 |
+
<option value="2" selected>Medium</option>
|
| 101 |
+
<option value="3">High (more colors)</option>
|
| 102 |
+
</select>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<div>
|
| 106 |
+
<label for="smoothness" class="block text-sm font-medium text-gray-700 mb-1">Smoothness</label>
|
| 107 |
+
<input type="range" id="smoothness" min="0" max="100" value="50" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 108 |
+
<div class="flex justify-between text-xs text-gray-500 mt-1">
|
| 109 |
+
<span>Rough</span>
|
| 110 |
+
<span>Balanced</span>
|
| 111 |
+
<span>Smooth</span>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<div>
|
| 116 |
+
<label for="detailLevel" class="block text-sm font-medium text-gray-700 mb-1">Detail Level</label>
|
| 117 |
+
<input type="range" id="detailLevel" min="1" max="10" value="5" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 118 |
+
<div class="flex justify-between text-xs text-gray-500 mt-1">
|
| 119 |
+
<span>Low</span>
|
| 120 |
+
<span>Medium</span>
|
| 121 |
+
<span>High</span>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<div class="flex items-center">
|
| 126 |
+
<input type="checkbox" id="transparentBg" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
|
| 127 |
+
<label for="transparentBg" class="ml-2 block text-sm text-gray-700">Transparent background</label>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<!-- Right Panel - Results -->
|
| 133 |
+
<div class="p-6 md:w-1/2">
|
| 134 |
+
<div class="flex justify-between items-center mb-4">
|
| 135 |
+
<h2 class="text-xl font-semibold text-gray-800">SVG Output</h2>
|
| 136 |
+
<div class="flex space-x-2">
|
| 137 |
+
<button id="downloadBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-3 py-1 rounded text-sm font-medium hidden">
|
| 138 |
+
<i class="fas fa-download mr-1"></i> Download
|
| 139 |
+
</button>
|
| 140 |
+
<button id="copyBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm font-medium hidden">
|
| 141 |
+
<i class="fas fa-copy mr-1"></i> Copy
|
| 142 |
+
</button>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
|
| 146 |
+
<div id="processingUI" class="hidden text-center py-12">
|
| 147 |
+
<div class="inline-block animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-indigo-500 mb-4"></div>
|
| 148 |
+
<h3 class="text-lg font-medium text-gray-700">Processing Image</h3>
|
| 149 |
+
<p class="text-gray-500 text-sm mt-1">This may take a few moments...</p>
|
| 150 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5 mt-4">
|
| 151 |
+
<div id="progressBar" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<div id="resultContainer" class="hidden">
|
| 156 |
+
<div class="bg-gray-100 rounded-lg p-4 mb-4">
|
| 157 |
+
<div id="svgPreview" class="mx-auto"></div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<div>
|
| 161 |
+
<div class="flex items-center justify-between mb-2">
|
| 162 |
+
<h4 class="text-sm font-medium text-gray-700">SVG Code</h4>
|
| 163 |
+
|
| 164 |
+
</html>
|