Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Political Cartoon Concept Generator</title> | |
| <!-- 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 { | |
| --bg-color: #121212; | |
| --card-bg: #1e1e1e; | |
| --text-main: #e0e0e0; | |
| --text-muted: #a0a0a0; | |
| --accent-red: #ff4d4d; | |
| --accent-black: #000000; | |
| --border-color: #333; | |
| --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| --font-comic: 'Courier New', Courier, monospace; /* Stylistic choice for the output */ | |
| } | |
| * { | |
| box-sizing: border-box; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| body { | |
| font-family: var(--font-main); | |
| background-color: var(--bg-color); | |
| color: var(--text-main); | |
| line-height: 1.6; | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| overflow-x: hidden; | |
| } | |
| /* --- Header --- */ | |
| header { | |
| background-color: #000; | |
| border-bottom: 2px solid var(--accent-red); | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| position: sticky; | |
| top: 0; | |
| z-index: 100; | |
| box-shadow: 0 4px 15px rgba(255, 77, 77, 0.2); | |
| } | |
| .brand { | |
| display: flex; | |
| align-items: center; | |
| gap: 15px; | |
| } | |
| .brand h1 { | |
| font-size: 1.5rem; | |
| font-weight: 800; | |
| text-transform: uppercase; | |
| letter-spacing: 2px; | |
| } | |
| .brand i { | |
| color: var(--accent-red); | |
| font-size: 1.8rem; | |
| } | |
| .built-with { | |
| font-size: 0.85rem; | |
| color: var(--text-muted); | |
| text-decoration: none; | |
| border: 1px solid var(--text-muted); | |
| padding: 5px 15px; | |
| border-radius: 50px; | |
| transition: all 0.3s ease; | |
| } | |
| .built-with:hover { | |
| background-color: var(--text-main); | |
| color: var(--bg-color); | |
| border-color: var(--text-main); | |
| } | |
| /* --- Main Layout --- */ | |
| main { | |
| flex: 1; | |
| padding: 2rem; | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| width: 100%; | |
| } | |
| /* --- Controls Section --- */ | |
| .controls-section { | |
| background-color: var(--card-bg); | |
| padding: 2rem; | |
| border-radius: 12px; | |
| border: 1px solid var(--border-color); | |
| margin-bottom: 3rem; | |
| box-shadow: 0 10px 30px rgba(0,0,0,0.5); | |
| } | |
| .input-group { | |
| margin-bottom: 1.5rem; | |
| } | |
| .input-group label { | |
| display: block; | |
| margin-bottom: 0.5rem; | |
| font-weight: 600; | |
| color: var(--text-main); | |
| } | |
| .input-group textarea, | |
| .input-group select { | |
| width: 100%; | |
| padding: 1rem; | |
| background-color: var(--bg-color); | |
| border: 1px solid var(--border-color); | |
| border-radius: 8px; | |
| color: var(--text-main); | |
| font-family: inherit; | |
| font-size: 1rem; | |
| transition: border-color 0.3s; | |
| } | |
| .input-group textarea:focus, | |
| .input-group select:focus { | |
| outline: none; | |
| border-color: var(--accent-red); | |
| } | |
| .btn-generate { | |
| background-color: var(--accent-red); | |
| color: white; | |
| border: none; | |
| padding: 1rem 2rem; | |
| font-size: 1.1rem; | |
| font-weight: bold; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| width: 100%; | |
| transition: transform 0.2s, box-shadow 0.2s; | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| .btn-generate:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 5px 20px rgba(255, 77, 77, 0.4); | |
| } | |
| .btn-generate:active { | |
| transform: translateY(0); | |
| } | |
| /* --- Output Section --- */ | |
| .output-container { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); | |
| gap: 2rem; | |
| } | |
| .concept-card { | |
| background-color: var(--card-bg); | |
| border-radius: 12px; | |
| overflow: hidden; | |
| border: 1px solid var(--border-color); | |
| position: relative; | |
| transition: transform 0.3s; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .concept-card:hover { | |
| transform: translateY(-5px); | |
| border-color: var(--accent-red); | |
| } | |
| .card-header { | |
| background-color: #2a2a2a; | |
| padding: 1rem 1.5rem; | |
| border-bottom: 1px solid var(--border-color); | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .card-title { | |
| font-size: 1.2rem; | |
| font-weight: 700; | |
| } | |
| .card-badge { | |
| background-color: var(--accent-red); | |
| color: white; | |
| padding: 0.25rem 0.75rem; | |
| border-radius: 4px; | |
| font-size: 0.75rem; | |
| font-weight: bold; | |
| text-transform: uppercase; | |
| } | |
| .card-body { | |
| padding: 1.5rem; | |
| flex: 1; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 1.5rem; | |
| } | |
| .concept-section { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 0.5rem; | |
| } | |
| .concept-section h4 { | |
| font-size: 0.9rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| .concept-content { | |
| font-size: 1rem; | |
| line-height: 1.7; | |
| } | |
| .caption-box { | |
| margin-top: auto; | |
| padding-top: 1.5rem; | |
| border-top: 1px dashed var(--border-color); | |
| } | |
| .caption-label { | |
| font-size: 0.8rem; | |
| color: var(--accent-red); | |
| font-weight: bold; | |
| margin-bottom: 0.5rem; | |
| display: block; | |
| } | |
| .caption-text { | |
| font-family: var(--font-comic); | |
| font-size: 1.4rem; | |
| font-weight: bold; | |
| color: #fff; | |
| text-align: center; | |
| background: #000; | |
| padding: 10px; | |
| border: 1px solid #333; | |
| border-radius: 4px; | |
| } | |
| /* --- Loading Overlay --- */ | |
| .loader-overlay { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-color: rgba(0, 0, 0, 0.85); | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| z-index: 1000; | |
| opacity: 0; | |
| pointer-events: none; | |
| transition: opacity 0.3s ease; | |
| } | |
| .loader-overlay.active { | |
| opacity: 1; | |
| pointer-events: all; | |
| } | |
| .loader-content { | |
| text-align: center; | |
| color: white; | |
| } | |
| .spinner { | |
| width: 50px; | |
| height: 50px; | |
| border: 5px solid rgba(255, 255, 255, 0.1); | |
| border-top-color: var(--accent-red); | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| margin: 0 auto 1.5rem; | |
| } | |
| .loader-text { | |
| font-size: 1.2rem; | |
| font-weight: bold; | |
| letter-spacing: 2px; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| /* --- Responsive Tweaks --- */ | |
| @media (max-width: 768px) { | |
| header { | |
| padding: 1rem; | |
| flex-direction: column; | |
| gap: 10px; | |
| } | |
| .btn-generate { | |
| width: 100%; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <div class="brand"> | |
| <i class="fa-solid fa-pen-nib"></i> | |
| <h1>Cartoonist AI</h1> | |
| </div> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">Built with anycoder</a> | |
| </header> | |
| <main> | |
| <!-- Input Section --> | |
| <section class="controls-section"> | |
| <div class="input-group"> | |
| <label for="storyInput">Story / Idea for the Cartoon</label> | |
| <textarea id="storyInput" rows="4" placeholder="Describe the political event, character dynamics, or satirical angle you want to explore..."></textarea> | |
| </div> | |
| <div class="input-group"> | |
| <label for="styleInput">Artist Style & Tone</label> | |
| <select id="styleInput"> | |
| <option value="standard">Standard Editorial</option> | |
| <option value="branco">Branco (Aggressive/Cross-hatched)</option> | |
| <option value="keane">Keane (Distorted/Humanizing)</option> | |
| <option value="robinson">Robinson (Political Satire)</option> | |
| </select> | |
| </div> | |
| <button class="btn-generate" id="generateBtn"> | |
| <i class="fa-solid fa-wand-magic-sparkles"></i> Generate Concepts | |
| </button> | |
| </section> | |
| <!-- Output Section --> | |
| <section id="outputArea" class="output-container"> | |
| <!-- Cards will be injected here via JS --> | |
| <div style="grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 3rem;"> | |
| <i class="fa-regular fa-image" style="font-size: 3rem; margin-bottom: 1rem; opacity: 0.5;"></i> | |
| <p>Enter a story idea and click Generate to see two unique concept directions.</p> | |
| </div> | |
| </section> | |
| </main> | |
| <!-- Loading Overlay --> | |
| <div class="loader-overlay" id="loader"> | |
| <div class="loader-content"> | |
| <div class="spinner"></div> | |
| <div class="loader-text">ANALYZING CONTEXT...</div> | |
| </div> | |
| </div> | |
| <script> | |
| // --- DOM Elements --- | |
| const generateBtn = document.getElementById('generateBtn'); | |
| const storyInput = document.getElementById('storyInput'); | |
| const styleInput = document.getElementById('styleInput'); | |
| const outputArea = document.getElementById('outputArea'); | |
| const loader = document.getElementById('loader'); | |
| // --- Mock Data / Logic --- | |
| // Since we cannot make actual API calls in a static HTML file without a backend proxy, | |
| // we will simulate the AI generation process with sophisticated logic. | |
| const MOCK_RESPONSES = [ | |
| { | |
| id: 1, | |
| title: "Concept 1: The Tightrope", | |
| caption: "Walking the Line", | |
| content: { | |
| setting: "A high-wire stretched precariously across a vast, stormy chasm. The sky is dark with ominous clouds.", | |
| characters: "A figure in a suit (representing the Leader) stands on the wire. He is sweating profusely, his knees shaking, and his face is a mask of terror. Beside him, a small, ragged dog (representing the People) clings to his ankle.", | |
| action: "The Leader is leaning heavily over the edge, trying to grab a floating, glowing orb labeled 'Policy', but he is losing his grip. The dog is barking in panic, trying to pull him back.", | |
| symbolism: "The wire represents the fragile state of the government. The chasm is the public's dissatisfaction or the political divide. The dog symbolizes the desperate, struggling populace." | |
| } | |
| }, | |
| { | |
| id: 2, | |
| title: "Concept 2: The Mirror", | |
| caption: "Reflecting Reality", | |
| content: { | |
| setting: "A sterile, white room with a large, cracked mirror on the wall. The floor is polished concrete.", | |
| characters: "A man (The Politician) stands facing the mirror. He is wearing a suit that is slightly too tight. His reflection, however, is wearing a clown suit with a red nose and is making obscene gestures.", | |
| action: "The Politician is pointing an accusing finger at his reflection, shouting, 'You're the problem!'. The reflection is not reacting, but is instead slowly removing its own head, revealing a dark void behind it.", | |
| symbolism: "The mirror represents the disconnect between a leader's self-perception and their actual impact. The clown suit implies incompetence or buffoonery, while the void suggests the lack of substance behind the persona." | |
| } | |
| } | |
| ]; | |
| // --- Helper Functions --- | |
| // Simulate a network request delay | |
| const simulateLoading = () => { | |
| return new Promise(resolve => { | |
| setTimeout(() => { | |
| resolve(); | |
| }, 2000); // 2 second delay | |
| }); | |
| }; | |
| // --- Event Listeners --- | |
| generateBtn.addEventListener('click', async () => { | |
| const story = storyInput.value.trim(); | |
| if (!story) { | |
| alert("Please enter a story or idea first!"); | |
| return; | |
| } | |
| // UI Feedback | |
| generateBtn.disabled = true; | |
| generateBtn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i> Generating...'; | |
| loader.classList.add('active'); | |
| // Simulate processing | |
| await simulateLoading(); | |
| // Render Results | |
| renderCards(MOCK_RESPONSES); | |
| // Reset UI | |
| loader.classList.remove('active'); | |
| generateBtn.disabled = false; | |
| generateBtn.innerHTML = '<i class="fa-solid fa-wand-magic-sparkles"></i> Generate Concepts'; | |
| }); | |
| function renderCards(concepts) { | |
| outputArea.innerHTML = ''; // Clear previous | |
| concepts.forEach(concept => { | |
| const card = document.createElement('article'); | |
| card.className = 'concept-card'; | |
| card.innerHTML = ` | |
| <div class="card-header"> | |
| <span class="card-title">${concept.title}</span> | |
| <span class="card-badge">Proposed</span> | |
| </div> | |
| <div class="card-body"> | |
| <div class="concept-section"> | |
| <h4>Setting</h4> | |
| <p class="concept-content">${concept.content.setting}</p> | |
| </div> | |
| <div class="concept-section"> | |
| <h4>Characters</h4> | |
| <p class="concept-content">${concept.content.characters}</p> | |
| </div> | |
| <div class="concept-section"> | |
| <h4>Action</h4> | |
| <p class="concept-content">${concept.content.action}</p> | |
| </div> | |
| <div class="concept-section"> | |
| <h4>Symbolism</h4> | |
| <p class="concept-content">${concept.content.symbolism}</p> | |
| </div> | |
| <div class="caption-box"> | |
| <span class="caption-label">CAPTION</span> | |
| <div class="caption-text">"${concept.caption}"</div> | |
| </div> | |
| </div> | |
| `; | |
| outputArea.appendChild(card); | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> |