dewmetime's picture
how can i get it to work correctly?
479a01e verified
Raw History Blame Contribute Delete
10.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AutoCaption Magic ✨</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
500: '#6366f1',
},
secondary: {
500: '#8b5cf6',
}
}
}
}
}
</script>
</head>
<body class="bg-gray-50 min-h-screen flex flex-col">
<custom-navbar></custom-navbar>
<main class="flex-grow container mx-auto px-4 py-12">
<div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-8">
<div class="text-center mb-10">
<h1 class="text-4xl font-bold text-primary-500 mb-4">AutoCaption Magic ✨</h1>
<p class="text-lg text-gray-600">Generate automatic captions for your LoRA training dataset</p>
</div>
<div class="space-y-8">
<div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Upload Your Images</h2>
<div class="border-2 border-dashed border-gray-300 rounded-lg p-12 text-center cursor-pointer hover:bg-gray-100 transition" id="uploadArea">
<i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-primary-500 mb-4"></i>
<p class="text-gray-600">Drag & drop your images here or click to browse</p>
<p class="text-sm text-gray-500 mt-2">Supports JPG, PNG (max 100 images at once)</p>
</div>
</div>
<div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Caption Settings</h2>
<div class="grid md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Trigger Word</label>
<input type="text" placeholder="e.g. 'myLoraStyle'" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<p class="text-xs text-gray-500 mt-1">This word will be prepended to all captions</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Model Type</label>
<select class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option>BLIP (Default)</option>
<option>CLIP Interrogator</option>
<option>BLIP-2</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Detail Level</label>
<select class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option>Medium (Recommended)</option>
<option>Brief</option>
<option>Detailed</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Include Tags</label>
<div class="flex items-center space-x-4">
<label class="inline-flex items-center">
<input type="checkbox" class="rounded border-gray-300 text-primary-500 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<span class="ml-2">Artistic Styles</span>
</label>
<label class="inline-flex items-center">
<input type="checkbox" class="rounded border-gray-300 text-primary-500 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<span class="ml-2">Medium/Technique</span>
</label>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Custom Prefix</label>
<input type="text" placeholder="e.g. 'a photo of'" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
</div>
</div>
</div>
<div class="flex justify-center">
<button class="px-8 py-3 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg shadow-md transition duration-300 flex items-center hovered-element" id="generateBtn">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap w-5 h-5 mr-2"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
Generate Captions
</button>
</div>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
feather.replace();
// File upload functionality
const uploadArea = document.getElementById('uploadArea');
const generateBtn = document.getElementById('generateBtn');
if (uploadArea) {
uploadArea.addEventListener('click', function() {
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.multiple = true;
fileInput.accept = 'image/*';
fileInput.click();
fileInput.addEventListener('change', function(e) {
if (e.target.files.length > 0) {
uploadArea.innerHTML = `
<i data-feather="check-circle" class="w-12 h-12 mx-auto text-green-500 mb-4"></i>
<p class="text-gray-600">${e.target.files.length} images selected</p>
<p class="text-sm text-gray-500 mt-2">Ready for caption generation</p>
`;
feather.replace();
// Enable generate button
if (generateBtn) {
generateBtn.disabled = false;
}
}
});
});
// Drag and drop functionality
uploadArea.addEventListener('dragover', function(e) {
e.preventDefault();
uploadArea.classList.add('bg-primary-50', 'border-primary-300');
});
uploadArea.addEventListener('dragleave', function(e) {
e.preventDefault();
uploadArea.classList.remove('bg-primary-50', 'border-primary-300');
});
uploadArea.addEventListener('drop', function(e) {
e.preventDefault();
uploadArea.classList.remove('bg-primary-50', 'border-primary-300');
if (e.dataTransfer.files.length > 0) {
uploadArea.innerHTML = `
<i data-feather="check-circle" class="w-12 h-12 mx-auto text-green-500 mb-4"></i>
<p class="text-gray-600">${e.dataTransfer.files.length} images selected</p>
<p class="text-sm text-gray-500 mt-2">Ready for caption generation</p>
`;
feather.replace();
// Enable generate button
if (generateBtn) {
generateBtn.disabled = false;
}
}
});
}
if (generateBtn) {
generateBtn.addEventListener('click', function() {
if (!this.disabled) {
this.innerHTML = `
<i data-feather="loader" class="w-5 h-5 mr-2 animate-spin"></i>
Generating Captions...
`;
feather.replace();
// Simulate caption generation
setTimeout(() => {
this.innerHTML = `
<i data-feather="check-circle" class="w-5 h-5 mr-2"></i>
Captions Generated!
`;
feather.replace();
// Show download option
setTimeout(() => {
this.innerHTML = `
<i data-feather="download" class="w-5 h-5 mr-2"></i>
Download Results
`;
feather.replace();
}, 3000);
}
});
}
});
</script>
</body>
</html>