Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- static/css/style.css +248 -0
- static/js/main.js +108 -0
- static/uploads/Screenshot_2026-02-10_105218.png +0 -0
- static/uploads/european-shorthair-8601492_1280.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
static/uploads/european-shorthair-8601492_1280.jpg filter=lfs diff=lfs merge=lfs -text
|
static/css/style.css
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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48;
|
| 4 |
+
--text-primary: #ffffff;
|
| 5 |
+
--text-secondary: #a0a5ba;
|
| 6 |
+
--accent-purple: #c299ff;
|
| 7 |
+
--accent-green: #00e699;
|
| 8 |
+
--btn-gradient: linear-gradient(90deg, #6366f1, #8b5cf6);
|
| 9 |
+
--btn-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
* {
|
| 13 |
+
margin: 0;
|
| 14 |
+
padding: 0;
|
| 15 |
+
box-sizing: border-box;
|
| 16 |
+
font-family: 'Outfit', sans-serif;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
body {
|
| 20 |
+
background-color: var(--bg-main);
|
| 21 |
+
color: var(--text-primary);
|
| 22 |
+
min-height: 100vh;
|
| 23 |
+
display: flex;
|
| 24 |
+
justify-content: center;
|
| 25 |
+
align-items: center;
|
| 26 |
+
padding: 2rem;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.main-wrapper {
|
| 30 |
+
width: 100%;
|
| 31 |
+
max-width: 900px;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.header {
|
| 35 |
+
text-align: center;
|
| 36 |
+
margin-bottom: 3rem;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.title {
|
| 40 |
+
font-size: 2.2rem;
|
| 41 |
+
font-weight: 800;
|
| 42 |
+
color: var(--accent-purple);
|
| 43 |
+
margin-bottom: 0.8rem;
|
| 44 |
+
text-transform: uppercase;
|
| 45 |
+
letter-spacing: -0.5px;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.subtitle {
|
| 49 |
+
color: var(--text-secondary);
|
| 50 |
+
font-size: 1.1rem;
|
| 51 |
+
font-weight: 400;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.stats-grid {
|
| 55 |
+
display: grid;
|
| 56 |
+
grid-template-columns: repeat(3, 1fr);
|
| 57 |
+
gap: 1.5rem;
|
| 58 |
+
margin-bottom: 3rem;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.stat-card {
|
| 62 |
+
background-color: var(--bg-card);
|
| 63 |
+
padding: 1.5rem;
|
| 64 |
+
border-radius: 12px;
|
| 65 |
+
text-align: center;
|
| 66 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.stat-label {
|
| 70 |
+
font-size: 0.8rem;
|
| 71 |
+
font-weight: 600;
|
| 72 |
+
color: var(--text-secondary);
|
| 73 |
+
margin-bottom: 0.5rem;
|
| 74 |
+
letter-spacing: 1px;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.stat-value {
|
| 78 |
+
font-size: 1.5rem;
|
| 79 |
+
font-weight: 700;
|
| 80 |
+
color: var(--accent-green);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.visualizer {
|
| 84 |
+
background-color: #2a3152;
|
| 85 |
+
padding: 3rem;
|
| 86 |
+
border-radius: 24px;
|
| 87 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.image-pair {
|
| 91 |
+
display: flex;
|
| 92 |
+
gap: 2rem;
|
| 93 |
+
margin-bottom: 2rem;
|
| 94 |
+
justify-content: center;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.image-column {
|
| 98 |
+
flex: 1;
|
| 99 |
+
max-width: 320px;
|
| 100 |
+
text-align: center;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.image-label {
|
| 104 |
+
color: var(--text-secondary);
|
| 105 |
+
font-size: 0.9rem;
|
| 106 |
+
font-weight: 600;
|
| 107 |
+
margin-bottom: 1rem;
|
| 108 |
+
text-transform: uppercase;
|
| 109 |
+
letter-spacing: 1px;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.image-container {
|
| 113 |
+
width: 100%;
|
| 114 |
+
aspect-ratio: 1/1;
|
| 115 |
+
background-color: #3b4266;
|
| 116 |
+
border-radius: 20px;
|
| 117 |
+
position: relative;
|
| 118 |
+
overflow: hidden;
|
| 119 |
+
display: flex;
|
| 120 |
+
align-items: center;
|
| 121 |
+
justify-content: center;
|
| 122 |
+
cursor: pointer;
|
| 123 |
+
border: 2px solid transparent;
|
| 124 |
+
transition: all 0.3s ease;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.image-container:hover {
|
| 128 |
+
background-color: #464d75;
|
| 129 |
+
border-color: rgba(255, 255, 255, 0.1);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.placeholder {
|
| 133 |
+
text-align: center;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.placeholder-icon {
|
| 137 |
+
font-size: 2.5rem;
|
| 138 |
+
margin-bottom: 0.5rem;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.placeholder p {
|
| 142 |
+
color: var(--text-secondary);
|
| 143 |
+
font-size: 0.9rem;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.display-img {
|
| 147 |
+
width: 100%;
|
| 148 |
+
height: 100%;
|
| 149 |
+
object-fit: cover;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.mode-toggle-group {
|
| 153 |
+
display: flex;
|
| 154 |
+
justify-content: center;
|
| 155 |
+
gap: 0.5rem;
|
| 156 |
+
margin-bottom: 2rem;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.mode-select-btn {
|
| 160 |
+
padding: 0.5rem 1rem;
|
| 161 |
+
border-radius: 8px;
|
| 162 |
+
border: none;
|
| 163 |
+
background-color: #3b4266;
|
| 164 |
+
color: var(--text-secondary);
|
| 165 |
+
cursor: pointer;
|
| 166 |
+
font-weight: 600;
|
| 167 |
+
font-size: 0.8rem;
|
| 168 |
+
transition: all 0.3s ease;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.mode-select-btn.active {
|
| 172 |
+
background-color: var(--accent-purple);
|
| 173 |
+
color: white;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.action-area {
|
| 177 |
+
text-align: center;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.btn-action {
|
| 181 |
+
background: var(--btn-gradient);
|
| 182 |
+
border: none;
|
| 183 |
+
padding: 1.2rem 3rem;
|
| 184 |
+
border-radius: 12px;
|
| 185 |
+
color: white;
|
| 186 |
+
font-size: 1.1rem;
|
| 187 |
+
font-weight: 700;
|
| 188 |
+
cursor: pointer;
|
| 189 |
+
box-shadow: var(--btn-shadow);
|
| 190 |
+
transition: all 0.3s ease;
|
| 191 |
+
margin-bottom: 1.5rem;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.btn-action:hover:not(:disabled) {
|
| 195 |
+
transform: translateY(-2px);
|
| 196 |
+
filter: brightness(1.1);
|
| 197 |
+
box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
.btn-action:disabled {
|
| 201 |
+
opacity: 0.5;
|
| 202 |
+
cursor: not-allowed;
|
| 203 |
+
filter: grayscale(0.5);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.model-info {
|
| 207 |
+
font-size: 0.8rem;
|
| 208 |
+
color: var(--text-secondary);
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.green {
|
| 212 |
+
color: var(--accent-green);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
.hidden {
|
| 216 |
+
display: none;
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/* Spinner */
|
| 220 |
+
.spinner {
|
| 221 |
+
width: 40px;
|
| 222 |
+
height: 40px;
|
| 223 |
+
border: 3px solid rgba(255, 255, 255, 0.1);
|
| 224 |
+
border-top: 3px solid var(--accent-green);
|
| 225 |
+
border-radius: 50%;
|
| 226 |
+
animation: spin 1s linear infinite;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
@keyframes spin {
|
| 230 |
+
0% {
|
| 231 |
+
transform: rotate(0deg);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
100% {
|
| 235 |
+
transform: rotate(360deg);
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
@media (max-width: 600px) {
|
| 240 |
+
.stats-grid {
|
| 241 |
+
grid-template-columns: 1fr;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.image-pair {
|
| 245 |
+
flex-direction: column;
|
| 246 |
+
align-items: center;
|
| 247 |
+
}
|
| 248 |
+
}
|
static/js/main.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const dropZone = document.getElementById('drop-zone');
|
| 2 |
+
const imageInput = document.getElementById('image-input');
|
| 3 |
+
const previewImg = document.getElementById('preview-img');
|
| 4 |
+
const inputPlaceholder = document.getElementById('input-placeholder');
|
| 5 |
+
const outputPlaceholder = document.getElementById('output-placeholder');
|
| 6 |
+
const transferBtn = document.getElementById('transfer-btn');
|
| 7 |
+
const loader = document.getElementById('loader');
|
| 8 |
+
const resultImg = document.getElementById('result-img');
|
| 9 |
+
const downloadLink = document.getElementById('download-link');
|
| 10 |
+
const modeBtns = document.querySelectorAll('.mode-select-btn');
|
| 11 |
+
|
| 12 |
+
let currentMode = 'h2z';
|
| 13 |
+
|
| 14 |
+
// Initialize stats with trained model values after DOM is loaded
|
| 15 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 16 |
+
document.getElementById('stat-epoch').textContent = '25 / 25';
|
| 17 |
+
document.getElementById('stat-gen-loss').textContent = '3.245';
|
| 18 |
+
document.getElementById('stat-disc-loss').textContent = '0.457';
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
// Mode selection
|
| 22 |
+
modeBtns.forEach(btn => {
|
| 23 |
+
btn.addEventListener('click', (e) => {
|
| 24 |
+
modeBtns.forEach(b => b.classList.remove('active'));
|
| 25 |
+
btn.classList.add('active');
|
| 26 |
+
currentMode = btn.dataset.mode;
|
| 27 |
+
|
| 28 |
+
// Update displays
|
| 29 |
+
if (currentMode === 'h2z') {
|
| 30 |
+
inputPlaceholder.querySelector('.placeholder-icon').textContent = 'π';
|
| 31 |
+
} else {
|
| 32 |
+
inputPlaceholder.querySelector('.placeholder-icon').textContent = 'π¦';
|
| 33 |
+
}
|
| 34 |
+
});
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
// File selection
|
| 38 |
+
dropZone.addEventListener('click', () => {
|
| 39 |
+
imageInput.click();
|
| 40 |
+
});
|
| 41 |
+
|
| 42 |
+
imageInput.addEventListener('change', (e) => {
|
| 43 |
+
if (e.target.files.length) {
|
| 44 |
+
handleFile(e.target.files[0]);
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
function handleFile(file) {
|
| 49 |
+
if (!file.type.startsWith('image/')) {
|
| 50 |
+
alert('Please select an image file.');
|
| 51 |
+
return;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
const reader = new FileReader();
|
| 55 |
+
reader.onload = (e) => {
|
| 56 |
+
previewImg.src = e.target.result;
|
| 57 |
+
previewImg.classList.remove('hidden');
|
| 58 |
+
inputPlaceholder.classList.add('hidden');
|
| 59 |
+
transferBtn.disabled = false;
|
| 60 |
+
|
| 61 |
+
// Clear result
|
| 62 |
+
resultImg.classList.add('hidden');
|
| 63 |
+
outputPlaceholder.classList.remove('hidden');
|
| 64 |
+
};
|
| 65 |
+
reader.readAsDataURL(file);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// Prediction
|
| 69 |
+
transferBtn.addEventListener('click', async () => {
|
| 70 |
+
const file = imageInput.files[0];
|
| 71 |
+
if (!file) return;
|
| 72 |
+
|
| 73 |
+
// Loading state
|
| 74 |
+
transferBtn.disabled = true;
|
| 75 |
+
loader.classList.remove('hidden');
|
| 76 |
+
outputPlaceholder.classList.add('hidden');
|
| 77 |
+
resultImg.classList.add('hidden');
|
| 78 |
+
|
| 79 |
+
const formData = new FormData();
|
| 80 |
+
formData.append('image', file);
|
| 81 |
+
formData.append('mode', currentMode);
|
| 82 |
+
|
| 83 |
+
try {
|
| 84 |
+
const response = await fetch('/predict', {
|
| 85 |
+
method: 'POST',
|
| 86 |
+
body: formData
|
| 87 |
+
});
|
| 88 |
+
|
| 89 |
+
const data = await response.json();
|
| 90 |
+
|
| 91 |
+
if (data.success) {
|
| 92 |
+
resultImg.src = data.result;
|
| 93 |
+
resultImg.classList.remove('hidden');
|
| 94 |
+
downloadLink.href = data.result;
|
| 95 |
+
downloadLink.download = `cyclegan_${currentMode}_${Date.now()}.png`;
|
| 96 |
+
} else {
|
| 97 |
+
alert('Transfer failed: ' + data.error);
|
| 98 |
+
outputPlaceholder.classList.remove('hidden');
|
| 99 |
+
}
|
| 100 |
+
} catch (err) {
|
| 101 |
+
alert('Communication error with server.');
|
| 102 |
+
console.error(err);
|
| 103 |
+
outputPlaceholder.classList.remove('hidden');
|
| 104 |
+
} finally {
|
| 105 |
+
loader.classList.add('hidden');
|
| 106 |
+
transferBtn.disabled = false;
|
| 107 |
+
}
|
| 108 |
+
});
|
static/uploads/Screenshot_2026-02-10_105218.png
ADDED
|
static/uploads/european-shorthair-8601492_1280.jpg
ADDED
|
Git LFS Details
|