MarkTheArtist's picture
Add 2 files
ec1f820 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stable Diffusion 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>
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
max-height: 200px;
overflow-y: auto;
border-radius: 0.5rem;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown-item {
color: black;
padding: 8px 16px;
text-decoration: none;
display: block;
cursor: pointer;
transition: all 0.2s;
}
.dropdown-item:hover {
background-color: #e2e8f0;
}
.dropdown-item.empty {
color: #999;
font-style: italic;
}
.highlight {
background-color: #fef08a;
padding: 0 2px;
border-radius: 4px;
transition: all 0.2s;
}
.highlight.empty {
background-color: #fee2e2;
text-decoration: line-through;
}
.highlight:hover {
background-color: #fde047;
cursor: pointer;
}
#promptDisplay {
min-height: 100px;
border: 1px solid #e2e8f0;
border-radius: 0.5rem;
padding: 1rem;
background-color: #f8fafc;
white-space: pre-wrap;
}
.copy-btn {
transition: all 0.2s;
}
.copy-btn:hover {
transform: scale(1.05);
}
.copy-btn.copied {
background-color: #10b981 !important;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen p-6">
<div class="max-w-4xl mx-auto">
<div class="text-center mb-8">
<h1 class="text-3xl font-bold text-indigo-700 mb-2">Stable Diffusion Prompt Generator</h1>
<p class="text-gray-600">Build your perfect prompt by selecting alternatives for each word</p>
</div>
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Customize Your Prompt:</h2>
<div id="wordSelectors" class="flex flex-wrap gap-2 mb-4">
<!-- Word selectors will be inserted here -->
</div>
</div>
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Your Generated Prompt:</h2>
<div id="promptDisplay" class="mb-4"></div>
<button id="copyBtn" class="copy-btn bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-4 rounded-lg flex items-center justify-center gap-2">
<i class="fas fa-copy"></i>
<span>Copy to Clipboard</span>
</button>
</div>
</div>
<div class="text-center text-gray-500 text-sm">
<p>Tip: Hover over any word to see alternative options. Select the empty option to remove a word.</p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Original prompt words with alternatives
const promptWords = [
{
word: "a",
type: "article",
alternatives: ["a", "an", "the", "some", "two", "three", "several", "many"]
},
{
word: "pair",
type: "quantity",
alternatives: ["pair", "couple", "duo", "twosome", "two", "few", "group of", "several"]
},
{
word: "of",
type: "preposition",
alternatives: ["of", "with", "and", "featuring", "including"]
},
{
word: "energetic",
type: "adjective",
alternatives: ["energetic", "playful", "lively", "cheerful", "vibrant", "dynamic", "active", "spirited"]
},
{
word: "charming",
type: "adjective",
alternatives: ["charming", "adorable", "cute", "sweet", "lovely", "endearing", "delightful", "appealing"]
},
{
word: "18-yo",
type: "age",
alternatives: ["18-yo", "17-yo", "16-yo", "15-yo", "14-yo", "13-yo", "12-yo", "11-yo", "10-yo", "12-yo", "young", "preteen", "teenage", "adolescent", "child"]
},
{
word: "naturalist",
type: "adjective",
alternatives: ["nudist", "naked", "bare", "unclothed", "clothes-free", "naturalist", "topless", "partially clothed"]
},
{
word: "girls",
type: "noun",
alternatives: ["girls", "children", "kids", "teens", "youngsters", "siblings", "friends", "twins"]
},
{
word: "kissing",
type: "verb",
alternatives: ["kissing", "hugging", "embracing", "holding", "touching", "caressing", "playing with", "interacting with"]
},
{
word: "an",
type: "article",
alternatives: ["a", "an", "the", "their", "some", "another"]
},
{
word: "older",
type: "adjective",
alternatives: ["older", "younger", "same-age", "teenage", "adult", "mature", "elder", "senior"]
},
{
word: "friend",
type: "noun",
alternatives: ["friend", "sister", "brother", "mother", "father", "companion", "peer", "relative"]
},
{
word: "running",
type: "verb",
alternatives: ["running", "walking", "playing", "dancing", "jumping", "laughing", "smiling", "exploring"]
},
{
word: "in",
type: "preposition",
alternatives: ["in", "on", "at", "through", "amidst", "among", "by", "near"]
},
{
word: "nature",
type: "noun",
alternatives: ["nature", "the forest", "the meadow", "the beach", "the park", "the wilderness", "the countryside", "the garden"]
}
];
const wordSelectors = document.getElementById('wordSelectors');
const promptDisplay = document.getElementById('promptDisplay');
const copyBtn = document.getElementById('copyBtn');
let currentPrompt = promptWords.map(item => item.word);
// Create word selectors
promptWords.forEach((wordObj, index) => {
const dropdown = document.createElement('div');
dropdown.className = 'dropdown';
const span = document.createElement('span');
span.className = 'highlight';
span.textContent = wordObj.word;
span.title = `Click to change (${wordObj.type})`;
const dropdownContent = document.createElement('div');
dropdownContent.className = 'dropdown-content';
// Add empty option first
const emptyItem = document.createElement('div');
emptyItem.className = 'dropdown-item empty';
emptyItem.textContent = '(remove)';
emptyItem.addEventListener('click', () => {
updatePrompt(index, '');
span.textContent = '';
span.classList.add('empty');
});
dropdownContent.appendChild(emptyItem);
// Add other alternatives
wordObj.alternatives.forEach(alt => {
const item = document.createElement('div');
item.className = 'dropdown-item';
item.textContent = alt;
item.addEventListener('click', () => {
updatePrompt(index, alt);
span.textContent = alt;
span.classList.remove('empty');
});
dropdownContent.appendChild(item);
});
dropdown.appendChild(span);
dropdown.appendChild(dropdownContent);
wordSelectors.appendChild(dropdown);
// Add space after each word except the last one
if (index < promptWords.length - 1) {
const space = document.createElement('span');
space.textContent = ' ';
wordSelectors.appendChild(space);
}
});
// Function to update the prompt
function updatePrompt(index, newWord) {
currentPrompt[index] = newWord;
renderPrompt();
}
// Function to render the prompt display
function renderPrompt() {
// Filter out empty words and join with spaces
const filteredPrompt = currentPrompt.filter(word => word.trim() !== '');
promptDisplay.textContent = filteredPrompt.join(' ') + (filteredPrompt.length > 0 ? '.' : '');
}
// Initial render
renderPrompt();
// Copy to clipboard functionality
copyBtn.addEventListener('click', () => {
const promptText = promptDisplay.textContent;
navigator.clipboard.writeText(promptText).then(() => {
copyBtn.classList.add('copied');
copyBtn.innerHTML = '<i class="fas fa-check"></i><span>Copied!</span>';
setTimeout(() => {
copyBtn.classList.remove('copied');
copyBtn.innerHTML = '<i class="fas fa-copy"></i><span>Copy to Clipboard</span>';
}, 2000);
});
});
});
</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=MarkTheArtist/stable-diffusion-builder" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>