File size: 10,097 Bytes
ca5f958 53920de ca5f958 479a01e ca5f958 b5abc96 ca5f958 479a01e ca5f958 53920de ca5f958 479a01e ca5f958 479a01e ca5f958 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <!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> |