Spaces:
Running
Running
File size: 20,478 Bytes
b6f529d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PhotoCritique - Professional Feedback Simulator</title>
<!-- Importing a font for modern typography -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap" rel="stylesheet">
<!-- Importing FontAwesome for Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #6366f1;
--primary-hover: #4f46e5;
--bg-dark: #0f172a;
--bg-card: #1e293b;
--text-main: #f8fafc;
--text-muted: #94a3b8;
--accent: #22d3ee;
--danger: #ef4444;
--success: #10b981;
--radius: 16px;
--shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-dark);
color: var(--text-main);
min-height: 100vh;
display: flex;
flex-direction: column;
line-height: 1.6;
}
/* Header */
header {
background: rgba(30, 41, 59, 0.8);
backdrop-filter: blur(10px);
padding: 1.5rem 2rem;
position: sticky;
top: 0;
z-index: 100;
border-bottom: 1px solid rgba(255,255,255,0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: 800;
background: linear-gradient(to right, var(--primary), var(--accent));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 0.5rem;
}
.attribution a {
color: var(--text-muted);
text-decoration: none;
font-size: 0.9rem;
transition: color 0.3s ease;
}
.attribution a:hover {
color: var(--primary);
}
/* Main Container */
main {
flex: 1;
max-width: 1200px;
width: 100%;
margin: 0 auto;
padding: 2rem;
display: flex;
flex-direction: column;
gap: 2rem;
}
/* Upload Section */
.upload-section {
background: var(--bg-card);
border-radius: var(--radius);
padding: 3rem;
text-align: center;
border: 2px dashed rgba(255,255,255,0.1);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.upload-section.drag-over {
border-color: var(--primary);
background: rgba(99, 102, 241, 0.1);
}
.upload-icon {
font-size: 4rem;
color: var(--text-muted);
margin-bottom: 1rem;
}
.upload-text h3 {
font-size: 1.5rem;
margin-bottom: 0.5rem;
}
.upload-text p {
color: var(--text-muted);
margin-bottom: 1.5rem;
}
.btn {
background: var(--primary);
color: white;
border: none;
padding: 0.8rem 2rem;
border-radius: 50px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, background 0.2s;
font-size: 1rem;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn:hover {
background: var(--primary-hover);
transform: translateY(-2px);
}
.btn:disabled {
background: var(--text-muted);
cursor: not-allowed;
transform: none;
}
#fileInput {
display: none;
}
/* Preview Area */
.preview-container {
display: none; /* Hidden by default */
background: var(--bg-card);
padding: 2rem;
border-radius: var(--radius);
box-shadow: var(--shadow);
flex-direction: column;
align-items: center;
gap: 2rem;
animation: fadeIn 0.5s ease;
}
.image-wrapper {
max-width: 100%;
max-height: 500px;
border-radius: 8px;
overflow: hidden;
border: 1px solid rgba(255,255,255,0.1);
}
.image-wrapper img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
.controls {
display: flex;
gap: 1rem;
flex-wrap: wrap;
justify-content: center;
}
.btn-secondary {
background: transparent;
border: 1px solid var(--text-muted);
color: var(--text-muted);
}
.btn-secondary:hover {
border-color: var(--text-main);
color: var(--text-main);
background: rgba(255,255,255,0.05);
}
/* Results Section */
.results-section {
display: none;
margin-top: 2rem;
}
.section-title {
font-size: 1.5rem;
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.reviews-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
}
/* Review Card */
.review-card {
background: var(--bg-card);
padding: 1.5rem;
border-radius: var(--radius);
border: 1px solid rgba(255,255,255,0.05);
display: flex;
flex-direction: column;
gap: 1rem;
animation: slideUp 0.5s ease forwards;
opacity: 0;
transform: translateY(20px);
}
.reviewer-header {
display: flex;
align-items: center;
gap: 1rem;
}
.avatar {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
border: 2px solid var(--primary);
}
.reviewer-info h4 {
font-size: 1rem;
margin-bottom: 0.2rem;
}
.reviewer-role {
font-size: 0.8rem;
color: var(--accent);
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 600;
}
.rating-stars {
color: #fbbf24;
font-size: 0.9rem;
}
.review-body {
font-size: 0.95rem;
color: #cbd5e1;
font-style: italic;
background: rgba(0,0,0,0.2);
padding: 1rem;
border-radius: 8px;
border-left: 3px solid var(--primary);
}
.review-tags {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.tag {
font-size: 0.75rem;
padding: 0.25rem 0.75rem;
border-radius: 20px;
background: rgba(255,255,255,0.1);
color: var(--text-muted);
}
/* Loading State */
.loading-overlay {
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem;
gap: 1rem;
}
.spinner {
width: 40px;
height: 40px;
border: 4px solid rgba(255,255,255,0.1);
border-left-color: var(--accent);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }
/* Responsive Adjustments */
@media (max-width: 768px) {
.upload-section { padding: 1.5rem; }
.logo span { display: none; }
.logo i { display: block; }
}
</style>
</head>
<body>
<header>
<div class="logo">
<i class="fa-solid fa-camera-retro"></i>
<span>PhotoCritique</span>
</div>
<div class="attribution">
Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a>
</div>
</header>
<main>
<!-- Upload Section -->
<section class="upload-section" id="dropZone">
<div class="upload-icon">
<i class="fa-solid fa-cloud-arrow-up"></i>
</div>
<div class="upload-text">
<h3>Upload your artwork</h3>
<p>Drag & drop a photo here, or click to browse</p>
</div>
<input type="file" id="fileInput" accept="image/*">
<button class="btn" onclick="document.getElementById('fileInput').click()">
Select Image
</button>
</section>
<!-- Preview & Action Section -->
<section class="preview-container" id="previewContainer">
<div class="image-wrapper">
<img id="imagePreview" src="" alt="Preview">
</div>
<div class="controls">
<button class="btn btn-secondary" id="resetBtn">
<i class="fa-solid fa-trash"></i> Clear
</button>
<button class="btn" id="analyzeBtn">
<i class="fa-solid fa-wand-magic-sparkles"></i> Get Critique
</button>
</div>
<!-- Loading Indicator -->
<div class="loading-overlay" id="loadingIndicator">
<div class="spinner"></div>
<p>Gathering reviews from top critics...</p>
</div>
</section>
<!-- Results Section -->
<section class="results-section" id="resultsSection">
<div class="section-title">
<i class="fa-solid fa-comments"></i> Critique Results
</div>
<div class="reviews-grid" id="reviewsGrid">
<!-- Reviews will be injected here via JS -->
</div>
</section>
</main>
<script>
// DOM Elements
const dropZone = document.getElementById('dropZone');
const fileInput = document.getElementById('fileInput');
const previewContainer = document.getElementById('previewContainer');
const imagePreview = document.getElementById('imagePreview');
const resetBtn = document.getElementById('resetBtn');
const analyzeBtn = document.getElementById('analyzeBtn');
const loadingIndicator = document.getElementById('loadingIndicator');
const resultsSection = document.getElementById('resultsSection');
const reviewsGrid = document.getElementById('reviewsGrid');
// State
let currentFile = null;
// --- Event Listeners ---
// Drag & Drop
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('drag-over');
});
dropZone.addEventListener('dragleave', () => {
dropZone.classList.remove('drag-over');
});
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('drag-over');
if (e.dataTransfer.files.length) {
handleFile(e.dataTransfer.files[0]);
}
});
// File Input Change
fileInput.addEventListener('change', (e) => {
if (e.target.files.length) {
handleFile(e.target.files[0]);
}
});
// Reset
resetBtn.addEventListener('click', resetApp);
// Analyze
analyzeBtn.addEventListener('click', generateCritiques);
// --- Functions ---
function handleFile(file) {
if (!file.type.startsWith('image/')) {
alert('Please upload a valid image file.');
return;
}
currentFile = file;
const reader = new FileReader();
reader.onload = (e) => {
imagePreview.src = e.target.result;
dropZone.style.display = 'none';
previewContainer.style.display = 'flex';
resultsSection.style.display = 'none';
};
reader.readAsDataURL(file);
}
function resetApp() {
currentFile = null;
fileInput.value = '';
dropZone.style.display = 'block';
previewContainer.style.display = 'none';
resultsSection.style.display = 'none';
reviewsGrid.innerHTML = '';
}
function generateCritiques() {
// UI Updates
analyzeBtn.disabled = true;
resetBtn.disabled = true;
loadingIndicator.style.display = 'flex';
resultsSection.style.display = 'none';
// Simulate API delay
setTimeout(() => {
const reviews = createMockReviews();
displayReviews(reviews);
// Restore UI
loadingIndicator.style.display = 'none';
analyzeBtn.disabled = false;
resetBtn.disabled = false;
resultsSection.style.display = 'block';
// Scroll to results
resultsSection.scrollIntoView({ behavior: 'smooth' });
}, 2000);
}
// --- Mock Data Generators ---
const personas = [
{
name: "Elena V.",
role: "Art Curator",
avatar: "https://picsum.photos/seed/elena/100/100",
style: "sophisticated"
},
{
name: "Marcus J.",
role: "Photography Prof",
avatar: "https://picsum.photos/seed/marcus/100/100",
style: "technical"
},
{
name: "Sarah L.",
role: "Creative Director",
avatar: "https://picsum.photos/seed/sarah/100/100",
style: "emotive"
}
];
const openers = {
sophisticated: [
"The composition here is quite striking.",
"There is a palpable sense of narrative in this piece.",
"I find the color palette rather intriguing.",
"This work challenges the viewer's perspective effectively."
],
technical: [
"The lighting setup suggests a professional approach.",
"I notice the depth of field is used strategically here.",
"The exposure balance is handled with precision.",
"Technically speaking, the framing adheres to the rule of thirds nicely."
],
emotive: [
"This image evokes a strong sense of nostalgia.",
"I can really feel the emotion captured in this moment.",
"There is a raw honesty present in this shot.",
"The mood conveyed is incredibly atmospheric."
]
};
const critiques = {
sophisticated: [
"However, I believe the negative space could be utilized more effectively to guide the eye. The juxtaposition of elements is clever, but perhaps slightly cluttered in the lower quadrant.",
"While the subject is compelling, the background elements distract slightly from the focal point. A subtle shift in aperture might have elevated this further.",
"The texture work is exquisite. I do wonder if a slightly warmer temperature would enhance the emotional resonance without compromising the realism."
],
technical: [
"Focus seems to be sharp on the primary subject, which is excellent. That said, the highlights are slightly blown out in the upper right corner; recovering those details in post would improve dynamic range.",
"The leading lines draw the eye well, but the horizon line appears slightly tilted. Correcting this rotation would stabilize the composition significantly.",
"ISO performance looks clean, indicating good lighting conditions. I would suggest experimenting with a wider shutter speed to introduce some motion blur for artistic effect."
],
emotive: [
"It connects with me on a personal level, though I feel the expression could be emphasized more through contrast. The story being told is clear, yet leaves room for interpretation.",
"There is a beautiful vulnerability here. To make it pop, I might suggest increasing the clarity slightly to bring out the textures in the shadows.",
"The atmosphere is undeniable. If the colors were slightly desaturated, I think it would add to the somber, reflective tone of the piece."
]
};
const tagsPool = [
"Creative", "Well-Lit", "Moody", "Dynamic", "Balanced",
"Raw", "Modern", "Classic", "Vibrant", "Detailed"
];
function createMockReviews() {
return personas.map((persona, index) => {
// Randomly select text parts based on persona style
const opener = openers[persona.style][Math.floor(Math.random() * openers[persona.style].length)];
const critique = critiques[persona.style][Math.floor(Math.random() * critiques[persona.style].length)];
// Generate random rating (3 to 5 stars)
const rating = Math.floor(Math.random() * 3) + 3;
// Generate 3 random tags
const shuffledTags = tagsPool.sort(() => 0.5 - Math.random());
const selectedTags = shuffledTags.slice(0, 3);
return {
...persona,
rating,
text: `${opener} ${critique}`,
tags: selectedTags,
delay: index * 200 // stagger animation
};
});
}
function displayReviews(reviews) {
reviewsGrid.innerHTML = '';
reviews.forEach(review => {
const card = document.createElement('article');
card.className = 'review-card';
card.style.animationDelay = `${review.delay}ms`;
// Create Stars HTML
let starsHtml = '';
for(let i=0; i<5; i++) {
if(i < review.rating) starsHtml += '<i class="fa-solid fa-star"></i>';
else starsHtml += '<i class="fa-regular fa-star"></i>';
}
// Create Tags HTML
const tagsHtml = review.tags.map(tag => `<span class="tag">#${tag}</span>`).join('');
card.innerHTML = `
<div class="reviewer-header">
<img src="${review.avatar}" alt="${review.name}" class="avatar">
<div class="reviewer-info">
<h4>${review.name}</h4>
<span class="reviewer-role">${review.role}</span>
</div>
</div>
<div class="rating-stars">${starsHtml}</div>
<div class="review-body">
"${review.text}"
</div>
<div class="review-tags">
${tagsHtml}
</div>
`;
reviewsGrid.appendChild(card);
});
}
</script>
</body>
</html> |