test / index.html
pakar23's picture
Add 1 files
fd9d510 verified
Raw History Blame Contribute Delete
17 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ImaginAI - Text to Image Generator</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
min-height: 100vh;
}
.gradient-bg {
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}
.result-container {
transition: all 0.3s ease;
}
.result-container:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.loading-spinner {
width: 50px;
height: 50px;
border: 5px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.prompt-input:focus {
outline: none;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}
</style>
</head>
<body class="min-h-screen">
<header class="gradient-bg text-white shadow-lg">
<div class="container mx-auto px-4 py-6">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-magic text-2xl"></i>
<h1 class="text-2xl font-bold">ImaginAI</h1>
</div>
<nav>
<ul class="flex space-x-6">
<li><a href="#" class="hover:text-gray-200 transition">Home</a></li>
<li><a href="#" class="hover:text-gray-200 transition">Gallery</a></li>
<li><a href="#" class="hover:text-gray-200 transition">About</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-12">
<section class="text-center mb-16">
<h2 class="text-4xl font-bold text-gray-800 mb-4">Turn Your Words Into Art</h2>
<p class="text-xl text-gray-600 max-w-2xl mx-auto">Describe your vision and our AI will generate stunning images for you. Try "A sunset over mountains with a lake reflection" or anything you can imagine!</p>
</section>
<section class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-12">
<div class="flex flex-col md:flex-row gap-6">
<div class="flex-1">
<div class="mb-6">
<label for="prompt" class="block text-gray-700 font-medium mb-2">Describe your image</label>
<textarea
id="prompt"
class="w-full prompt-input px-4 py-3 border border-gray-300 rounded-lg focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition"
rows="4"
placeholder="A futuristic cityscape at night with neon lights reflecting on wet streets..."
></textarea>
</div>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">Style</label>
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
<button class="style-btn px-4 py-2 border rounded-lg hover:bg-indigo-50 transition" data-style="realistic">Realistic</button>
<button class="style-btn px-4 py-2 border rounded-lg hover:bg-indigo-50 transition" data-style="fantasy">Fantasy</button>
<button class="style-btn px-4 py-2 border rounded-lg hover:bg-indigo-50 transition" data-style="abstract">Abstract</button>
<button class="style-btn px-4 py-2 border rounded-lg hover:bg-indigo-50 transition" data-style="cartoon">Cartoon</button>
</div>
</div>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">Color Palette</label>
<div class="flex space-x-2">
<div class="color-option w-8 h-8 rounded-full bg-red-500 cursor-pointer border-2 border-white shadow" data-color="red"></div>
<div class="color-option w-8 h-8 rounded-full bg-blue-500 cursor-pointer border-2 border-white shadow" data-color="blue"></div>
<div class="color-option w-8 h-8 rounded-full bg-green-500 cursor-pointer border-2 border-white shadow" data-color="green"></div>
<div class="color-option w-8 h-8 rounded-full bg-yellow-500 cursor-pointer border-2 border-white shadow" data-color="yellow"></div>
<div class="color-option w-8 h-8 rounded-full bg-purple-500 cursor-pointer border-2 border-white shadow" data-color="purple"></div>
<div class="color-option w-8 h-8 rounded-full bg-pink-500 cursor-pointer border-2 border-white shadow" data-color="pink"></div>
</div>
</div>
<div class="flex justify-between items-center">
<div>
<label class="inline-flex items-center">
<input type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50" id="high-quality">
<span class="ml-2 text-gray-700">High Quality</span>
</label>
</div>
<button id="generate-btn" class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition flex items-center">
<i class="fas fa-sparkles mr-2"></i> Generate Image
</button>
</div>
</div>
<div class="flex-1 flex items-center justify-center">
<div id="result-container" class="result-container w-full h-64 md:h-80 bg-gray-100 rounded-lg flex items-center justify-center overflow-hidden relative">
<div id="placeholder" class="text-center p-4">
<i class="fas fa-image text-4xl text-gray-400 mb-3"></i>
<p class="text-gray-500">Your generated image will appear here</p>
</div>
<div id="loading" class="hidden absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center">
<div class="loading-spinner"></div>
</div>
<img id="generated-image" class="hidden w-full h-full object-cover" src="" alt="Generated image">
</div>
</div>
</div>
</section>
<section class="mb-12">
<h3 class="text-2xl font-bold text-gray-800 mb-6">Recent Creations</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
<div class="bg-white rounded-xl overflow-hidden shadow-md hover:shadow-lg transition cursor-pointer">
<img src="https://source.unsplash.com/random/300x300/?fantasy" alt="Sample image" class="w-full h-48 object-cover">
<div class="p-4">
<p class="text-gray-600">"A dragon flying over a medieval castle"</p>
</div>
</div>
<div class="bg-white rounded-xl overflow-hidden shadow-md hover:shadow-lg transition cursor-pointer">
<img src="https://source.unsplash.com/random/300x300/?cyberpunk" alt="Sample image" class="w-full h-48 object-cover">
<div class="p-4">
<p class="text-gray-600">"Neon-lit Tokyo street in rain"</p>
</div>
</div>
<div class="bg-white rounded-xl overflow-hidden shadow-md hover:shadow-lg transition cursor-pointer">
<img src="https://source.unsplash.com/random/300x300/?portrait" alt="Sample image" class="w-full h-48 object-cover">
<div class="p-4">
<p class="text-gray-600">"Portrait of a cybernetic woman"</p>
</div>
</div>
<div class="bg-white rounded-xl overflow-hidden shadow-md hover:shadow-lg transition cursor-pointer">
<img src="https://source.unsplash.com/random/300x300/?landscape" alt="Sample image" class="w-full h-48 object-cover">
<div class="p-4">
<p class="text-gray-600">"Alpine meadow at sunrise"</p>
</div>
</div>
</div>
</section>
</main>
<footer class="bg-gray-800 text-white py-8">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<h3 class="text-xl font-bold mb-2">ImaginAI</h3>
<p class="text-gray-400">Turning imagination into reality</p>
</div>
<div class="flex space-x-6">
<a href="#" class="hover:text-indigo-400 transition"><i class="fab fa-twitter"></i></a>
<a href="#" class="hover:text-indigo-400 transition"><i class="fab fa-instagram"></i></a>
<a href="#" class="hover:text-indigo-400 transition"><i class="fab fa-discord"></i></a>
<a href="#" class="hover:text-indigo-400 transition"><i class="fab fa-github"></i></a>
</div>
</div>
<div class="border-t border-gray-700 mt-6 pt-6 text-center text-gray-400">
<p>&copy; 2023 ImaginAI. All rights reserved.</p>
</div>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const generateBtn = document.getElementById('generate-btn');
const promptInput = document.getElementById('prompt');
const placeholder = document.getElementById('placeholder');
const loading = document.getElementById('loading');
const generatedImage = document.getElementById('generated-image');
const resultContainer = document.getElementById('result-container');
const styleButtons = document.querySelectorAll('.style-btn');
const colorOptions = document.querySelectorAll('.color-option');
const highQualityCheckbox = document.getElementById('high-quality');
let selectedStyle = 'realistic';
let selectedColor = '';
// Style selection
styleButtons.forEach(button => {
button.addEventListener('click', function() {
styleButtons.forEach(btn => btn.classList.remove('bg-indigo-100', 'border-indigo-500'));
this.classList.add('bg-indigo-100', 'border-indigo-500');
selectedStyle = this.dataset.style;
});
});
// Color selection
colorOptions.forEach(option => {
option.addEventListener('click', function() {
colorOptions.forEach(opt => opt.classList.remove('ring-2', 'ring-offset-2', 'ring-indigo-500'));
this.classList.add('ring-2', 'ring-offset-2', 'ring-indigo-500');
selectedColor = this.dataset.color;
});
});
// Generate image
generateBtn.addEventListener('click', function() {
const prompt = promptInput.value.trim();
if (!prompt) {
alert('Please enter a description for your image');
return;
}
// Show loading state
placeholder.classList.add('hidden');
loading.classList.remove('hidden');
generatedImage.classList.add('hidden');
generateBtn.disabled = true;
generateBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Generating...';
// Simulate API call with timeout
setTimeout(() => {
// In a real app, you would call an actual text-to-image API here
// For demo purposes, we'll use a placeholder image
const mockImages = [
'https://source.unsplash.com/random/600x600/?fantasy',
'https://source.unsplash.com/random/600x600/?landscape',
'https://source.unsplash.com/random/600x600/?future',
'https://source.unsplash.com/random/600x600/?abstract',
'https://source.unsplash.com/random/600x600/?cyberpunk'
];
const randomImage = mockImages[Math.floor(Math.random() * mockImages.length)];
generatedImage.src = randomImage;
generatedImage.alt = prompt;
generatedImage.onload = function() {
loading.classList.add('hidden');
generatedImage.classList.remove('hidden');
generateBtn.disabled = false;
generateBtn.innerHTML = '<i class="fas fa-sparkles mr-2"></i> Generate Image';
// Add to recent creations
addToRecentCreations(prompt, randomImage);
};
}, 2000);
});
// Add to recent creations (demo)
function addToRecentCreations(prompt, imageUrl) {
const recentContainer = document.querySelector('.grid-cols-1');
if (recentContainer) {
const newItem = document.createElement('div');
newItem.className = 'bg-white rounded-xl overflow-hidden shadow-md hover:shadow-lg transition cursor-pointer';
newItem.innerHTML = `
<img src="${imageUrl}" alt="Generated image" class="w-full h-48 object-cover">
<div class="p-4">
<p class="text-gray-600">"${prompt}"</p>
</div>
`;
recentContainer.prepend(newItem);
}
}
// Sample prompt suggestions
const samplePrompts = [
"A futuristic cityscape at night with neon lights",
"A mystical forest with glowing plants and fairies",
"A portrait of a cyberpunk samurai",
"An underwater city with coral skyscrapers",
"A steampunk airship flying over mountains"
];
// Rotate sample prompts in the placeholder
let currentPromptIndex = 0;
setInterval(() => {
promptInput.placeholder = samplePrompts[currentPromptIndex];
currentPromptIndex = (currentPromptIndex + 1) % samplePrompts.length;
}, 3000);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=pakar23/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>