Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Image to AI Prompt 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> | |
.dropzone { | |
border: 2px dashed #9CA3AF; | |
transition: all 0.3s ease; | |
} | |
.dropzone.active { | |
border-color: #3B82F6; | |
background-color: #EFF6FF; | |
} | |
.prompt-card { | |
background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%); | |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); | |
transition: all 0.3s ease; | |
} | |
.prompt-card:hover { | |
transform: translateY(-2px); | |
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
} | |
.loading-spinner { | |
animation: spin 1s linear infinite; | |
} | |
@keyframes spin { | |
0% { transform: rotate(0deg); } | |
100% { transform: rotate(360deg); } | |
} | |
.image-preview { | |
max-height: 300px; | |
object-fit: contain; | |
} | |
</style> | |
</head> | |
<body class="bg-gray-50 min-h-screen"> | |
<div class="container mx-auto px-4 py-12"> | |
<div class="text-center mb-12"> | |
<h1 class="text-4xl font-bold text-gray-800 mb-3">AI Prompt Generator</h1> | |
<p class="text-xl text-gray-600 max-w-2xl mx-auto"> | |
Upload any image and get creative AI prompts that describe it perfectly. Perfect for artists, writers, and content creators! | |
</p> | |
</div> | |
<div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-12"> | |
<div id="upload-section" class="text-center"> | |
<div id="dropzone" class="dropzone rounded-lg p-12 cursor-pointer mb-6"> | |
<div class="flex flex-col items-center justify-center"> | |
<i class="fas fa-cloud-upload-alt text-4xl text-blue-500 mb-4"></i> | |
<h3 class="text-xl font-semibold text-gray-700 mb-2">Drag & Drop your image here</h3> | |
<p class="text-gray-500 mb-4">or</p> | |
<label for="file-upload" class="px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition cursor-pointer"> | |
Browse Files | |
</label> | |
<input id="file-upload" type="file" accept="image/*" class="hidden"> | |
</div> | |
</div> | |
<div id="image-preview-container" class="hidden mb-6"> | |
<div class="flex justify-center mb-4"> | |
<img id="image-preview" class="image-preview rounded-lg shadow-md" src="" alt="Preview"> | |
</div> | |
<button id="generate-btn" class="px-8 py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg font-semibold hover:opacity-90 transition flex items-center mx-auto"> | |
<i class="fas fa-magic mr-2"></i> Generate AI Prompts | |
</button> | |
</div> | |
<div id="loading" class="hidden py-8"> | |
<div class="flex flex-col items-center"> | |
<div class="loading-spinner w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full mb-4"></div> | |
<p class="text-gray-700">Analyzing your image and generating creative prompts...</p> | |
</div> | |
</div> | |
</div> | |
<div id="results-section" class="hidden"> | |
<div class="flex justify-between items-center mb-6"> | |
<h2 class="text-2xl font-bold text-gray-800">Generated Prompts</h2> | |
<button id="new-upload" class="text-blue-500 hover:text-blue-700 flex items-center"> | |
<i class="fas fa-upload mr-2"></i> Upload New Image | |
</button> | |
</div> | |
<div id="prompts-container" class="space-y-4"> | |
<!-- Prompts will be inserted here --> | |
</div> | |
<div class="mt-8 pt-6 border-t border-gray-200"> | |
<h3 class="text-lg font-semibold text-gray-700 mb-4">Need variations?</h3> | |
<div class="flex space-x-3"> | |
<button id="regenerate-btn" class="px-6 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition flex items-center"> | |
<i class="fas fa-sync-alt mr-2"></i> Regenerate | |
</button> | |
<button id="enhance-btn" class="px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition flex items-center"> | |
<i class="fas fa-plus-circle mr-2"></i> Enhance Prompts | |
</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="max-w-3xl mx-auto text-center text-gray-500 text-sm"> | |
<p>This tool helps artists, writers, and content creators generate detailed AI prompts from images. Use these prompts for AI image generation, creative writing, or artistic inspiration.</p> | |
</div> | |
</div> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
const dropzone = document.getElementById('dropzone'); | |
const fileInput = document.getElementById('file-upload'); | |
const imagePreview | |
</html> |