AuraVision – Next-Gen AI Studio
by BlazeKoala99457 lines17.5 KB
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AuraVision – Next-Gen AI Studio</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #090a0f;
--surface: rgba(25, 30, 46, 0.6);
--surface-solid: #151926;
--border: rgba(255, 255, 255, 0.08);
--primary: #8b5cf6;
--primary-hover: #7c3aed;
--primary-glow: rgba(139, 92, 246, 0.3);
--text: #f3f4f6;
--text-muted: #9ca3af;
--error: #f87171;
--radius: 20px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-image:
radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 40%);
padding: 20px;
}
.app-container {
width: 100%;
max-width: 640px;
background: var(--surface);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 32px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}
header { text-align: center; margin-bottom: 28px; }
header h1 {
font-size: 24px;
font-weight: 700;
letter-spacing: -0.5px;
background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
header p { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.nav-tabs {
display: grid;
grid-template-columns: 1fr 1fr;
background: rgba(0, 0, 0, 0.2);
padding: 4px;
border-radius: 14px;
border: 1px solid var(--border);
margin-bottom: 24px;
}
.tab-btn {
background: transparent;
border: none;
color: var(--text-muted);
padding: 10px;
font-weight: 600;
font-size: 13px;
border-radius: 10px;
cursor: pointer;
transition: all 0.25s ease;
}
.tab-btn.active {
background: var(--surface-solid);
color: var(--text);
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.workspace { display: none; animation: fadeIn 0.3s ease forwards; }
.workspace.active { display: block; }
@keyframes fadeIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.input-group { margin-bottom: 20px; }
label {
display: block;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.8px;
color: var(--text-muted);
margin-bottom: 8px;
}
textarea, select {
width: 100%;
background: rgba(0, 0, 0, 0.3);
border: 1px solid var(--border);
border-radius: 12px;
padding: 14px;
color: var(--text);
font-family: inherit;
font-size: 14px;
resize: vertical;
transition: all 0.2s ease;
}
textarea:focus, select:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px var(--primary-glow);
}
.controls-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-bottom: 20px;
}
.action-btn {
width: 100%;
background: var(--primary);
color: white;
border: none;
padding: 14px;
border-radius: 12px;
font-weight: 600;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 15px var(--primary-glow);
}
.action-btn:hover:not(:disabled) {
background: var(--primary-hover);
transform: translateY(-1px);
}
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary-btn {
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border);
color: var(--text);
box-shadow: none;
margin-top: 12px;
}
.secondary-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.output-box {
margin-top: 20px;
background: rgba(0, 0, 0, 0.4);
border: 1px dashed var(--border);
border-radius: 14px;
min-height: 220px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
padding: 16px;
text-align: center;
color: var(--text-muted);
font-size: 13px;
}
.output-box img {
max-width: 100%;
max-height: 350px;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.output-box.error { color: var(--error); }
.dropzone {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 24px;
text-align: center;
background: rgba(0, 0, 0, 0.2);
cursor: pointer;
transition: all 0.2s;
}
.dropzone:hover, .dropzone:focus-visible {
border-color: var(--primary);
background: rgba(139, 92, 246, 0.05);
outline: none;
}
.loader {
display: none;
flex-direction: column;
align-items: center;
gap: 10px;
}
.spinner {
width: 36px;
height: 36px;
border: 3px solid rgba(255,255,255,0.1);
border-top: 3px solid var(--primary);
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
</style>
</head>
<body>
<div class="app-container">
<header>
<h1>AuraVision</h1>
<p>Generative KI-Plattform für Bild & Analyse</p>
</header>
<div class="nav-tabs" role="tablist">
<button class="tab-btn active" role="tab" onclick="switchWorkspace(0)">Text zu Bild</button>
<button class="tab-btn" role="tab" onclick="switchWorkspace(1)">Bild zu Text</button>
</div>
<!-- Workspace 1: Text zu Bild -->
<div class="workspace active" id="ws-text2img">
<div class="input-group">
<label for="promptInput">Prompt / Beschreibung</label>
<textarea id="promptInput" rows="3" maxlength="1000"
placeholder="Z. B. Ein mystischer Kristallwald im Mondlicht..."></textarea>
<p class="hint">Strg + Enter startet die Generierung.</p>
</div>
<div class="controls-row">
<div class="input-group" style="margin-bottom:0;">
<label for="modelSelect">Stil / Modell</label>
<select id="modelSelect">
<option value="flux">Flux (Realistisch)</option>
<option value="turbo">Turbo (Schnell)</option>
</select>
</div>
<div class="input-group" style="margin-bottom:0;">
<label for="ratioSelect">Format</label>
<select id="ratioSelect">
<option value="1024x1024">1:1 Quadratisch</option>
<option value="1280x720">16:9 Landschaft</option>
<option value="720x1280">9:16 Hochformat</option>
</select>
</div>
</div>
<button class="action-btn" id="genBtn" style="margin-top:20px;" onclick="generateImage()">Bild generieren</button>
<div class="output-box" id="t2iOutput">
<span id="t2iPlaceholder">Dein generiertes Bild erscheint hier</span>
<div class="loader" id="t2iLoader">
<div class="spinner"></div>
<span>Erstelle Kunstwerk...</span>
</div>
</div>
<div class="btn-row" id="t2iActions" style="display:none;">
<button class="action-btn secondary-btn" id="regenBtn" onclick="generateImage(true)">Neue Variante</button>
<button class="action-btn secondary-btn" id="t2iDownload" onclick="downloadImage()">Herunterladen</button>
</div>
</div>
<!-- Workspace 2: Bild zu Text -->
<div class="workspace" id="ws-img2text">
<div class="input-group">
<label for="fileInput">Bild hochladen</label>
<div class="dropzone" role="button" tabindex="0"
onclick="document.getElementById('fileInput').click()"
onkeydown="if(event.key==='Enter'||event.key===' '){document.getElementById('fileInput').click()}">
<span id="dropzoneText">Klicken, um ein Bild auszuwählen</span>
<input type="file" id="fileInput" accept="image/*" style="display:none;" onchange="handleFile(event)">
</div>
</div>
<div class="output-box" id="previewBox" style="min-height: 120px;">Vorschau</div>
<button class="action-btn" id="analyzeBtn" style="margin-top:16px;" onclick="analyzeImage()">Bild analysieren</button>
<div class="output-box" id="analysisOutput" style="margin-top:16px; min-height: 100px; display: block; text-align: left;">
<span style="color: var(--text-muted);" id="analysisText">Die Analyse wird hier angezeigt...</span>
</div>
<button class="action-btn secondary-btn" id="useAnalysisBtn" style="display:none;" onclick="transferToGen()">Als Prompt für Bildgeneration nutzen →</button>
</div>
</div>
<script>
const MAX_PROMPT_LENGTH = 800;
const REQUEST_TIMEOUT_MS = 60000;
let activeImageUrl = "";
let activeBlob = null;
let uploadedBase64 = "";
let lastAnalysisText = "";
let lastPrompt = "";
document.getElementById('promptInput').addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'Enter') generateImage();
});
function switchWorkspace(index) {
document.querySelectorAll('.tab-btn').forEach((btn, i) => btn.classList.toggle('active', i === index));
document.querySelectorAll('.workspace').forEach((ws, i) => ws.classList.toggle('active', i === index));
}
function fetchWithTimeout(url, options = {}) {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
return fetch(url, { ...options, signal: controller.signal }).finally(() => clearTimeout(timer));
}
function loadImage(src) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = () => reject(new Error('Bild konnte nicht geladen werden.'));
img.src = src;
});
}
function setT2IBusy(busy) {
document.getElementById('genBtn').disabled = busy;
document.getElementById('regenBtn').disabled = busy;
document.getElementById('t2iDownload').disabled = busy;
}
async function generateImage(isVariant = false) {
const input = document.getElementById('promptInput');
const prompt = (isVariant && lastPrompt ? lastPrompt : input.value).trim().slice(0, MAX_PROMPT_LENGTH);
const model = document.getElementById('modelSelect').value;
const [width, height] = document.getElementById('ratioSelect').value.split('x');
const outputBox = document.getElementById('t2iOutput');
const placeholder = document.getElementById('t2iPlaceholder');
const loader = document.getElementById('t2iLoader');
const actions = document.getElementById('t2iActions');
if (!prompt) {
alert('Bitte gib zuerst eine Beschreibung ein.');
return;
}
lastPrompt = prompt;
outputBox.classList.remove('error');
outputBox.querySelector('img')?.remove();
placeholder.style.display = 'none';
loader.style.display = 'flex';
actions.style.display = 'none';
setT2IBusy(true);
const seed = Math.floor(Math.random() * 999999);
activeImageUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(prompt)}?model=${model}&width=${width}&height=${height}&seed=${seed}&nologo=true`;
try {
const res = await fetchWithTimeout(activeImageUrl);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
activeBlob = await res.blob();
const objectUrl = URL.createObjectURL(activeBlob);
const img = await loadImage(objectUrl);
img.alt = prompt;
outputBox.appendChild(img);
actions.style.display = 'grid';
} catch (err) {
activeBlob = null;
placeholder.style.display = 'block';
placeholder.innerText = err.name === 'AbortError'
? 'Zeitüberschreitung. Bitte erneut versuchen.'
: 'Fehler beim Generieren. Bitte erneut versuchen.';
outputBox.classList.add('error');
} finally {
loader.style.display = 'none';
setT2IBusy(false);
}
}
async function downloadImage() {
if (!activeBlob) return;
const link = document.createElement('a');
link.href = URL.createObjectURL(activeBlob);
link.download = `auravision-${Date.now()}.jpg`;
document.body.appendChild(link);
link.click();
link.remove();
}
function handleFile(e) {
const file = e.target.files[0];
if (!file) return;
if (!file.type.startsWith('image/')) {
alert('Bitte wähle eine Bilddatei aus.');
return;
}
document.getElementById('dropzoneText').innerText = file.name;
document.getElementById('useAnalysisBtn').style.display = 'none';
const reader = new FileReader();
reader.onload = (event) => {
uploadedBase64 = event.target.result;
const preview = document.getElementById('previewBox');
preview.innerHTML = '';
const img = document.createElement('img');
img.src = uploadedBase64;
img.alt = 'Vorschau des hochgeladenen Bildes';
img.style.maxHeight = '110px';
preview.appendChild(img);
};
reader.readAsDataURL(file);
}
async function analyzeImage() {
if (!uploadedBase64) {
alert('Bitte lade zuerst ein Bild hoch.');
return;
}
const analysisText = document.getElementById('analysisText');
const analyzeBtn = document.getElementById('analyzeBtn');
analysisText.textContent = 'Analysiere Bilddetails...';
analyzeBtn.disabled = true;
try {
const res = await fetchWithTimeout('https://text.pollinations.ai/openai', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'openai',
messages: [{
role: 'user',
content: [
{ type: 'text', text: 'Beschreibe dieses Bild präzise und detailliert auf Deutsch (Stil, Motive, Farbgebung, Licht, Komposition). Antworte nur mit der Beschreibung.' },
{ type: 'image_url', image_url: { url: uploadedBase64 } }
]
}]
})
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
const content = data.choices?.[0]?.message?.content?.trim();
if (!content) throw new Error('Leere Antwort');
lastAnalysisText = content;
analysisText.textContent = content;
document.getElementById('useAnalysisBtn').style.display = 'block';
} catch (err) {
analysisText.textContent = err.name === 'AbortError'
? 'Zeitüberschreitung bei der Bildanalyse. Bitte erneut versuchen.'
: 'Fehler bei der Bildanalyse. Bitte erneut versuchen.';
} finally {
analyzeBtn.disabled = false;
}
}
function transferToGen() {
if (!lastAnalysisText) return;
document.getElementById('promptInput').value = lastAnalysisText;
switchWorkspace(0);
generateImage();
}
</script>
</body>
</html>
Game Source: AuraVision – Next-Gen AI Studio
Creator: BlazeKoala99
Libraries: none
Complexity: complex (457 lines, 17.5 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: auravision-next-gen-ai-studio-blazekoala99" to link back to the original. Then publish at arcadelab.ai/publish.