text stringlengths 0 106k |
|---|
</body> |
</html> |
body { |
background: #f8f9fa; |
} |
.container { |
padding: 2rem; |
} |
.input-container { |
text-align: left; |
width: 100%; |
} |
.form-label { |
font-size: 0.8rem; |
font-weight: bold; |
color: #333; |
margin-bottom: 0.5rem; |
} |
.form-control { |
height: auto; |
font-size: 1.2rem; |
overflow: hidden; |
resize: none; |
} |
.btn { |
height: 3rem; |
font-size: 1.2rem; |
width: 100%; |
} |
let textareas = document.querySelectorAll('textarea'); |
textareas.forEach(textarea => { |
textarea.addEventListener('input', autoResize, false); |
}); |
function autoResize() { |
this.style.height = 'auto'; |
this.style.height = this.scrollHeight + 'px'; |
} |
['Imagine', 'Replicate', 'Leonardo', 'PlaygroundAI'].forEach(provider => document.getElementById('provider').add(new Option(provider, provider))); |
document.getElementById('provider').value = 'Leonardo'; |
['SDXL', 'Stable Diffusion 2.1', 'Stable Diffusion 1.5', 'Playground V1'].forEach(model => document.getElementById('model').add(new Option(model, model))); |
document.getElementById('model').value = 'SDXL'; |
['Photoreal', 'Pixar 3D', 'Painting', 'None'].forEach(style => document.getElementById('style').add(new Option(style, style))); |
document.getElementById('style').value = 'None'; |
['16:9', '9:16', '4:3', '3:4', "3:2","2:3","1:1"].forEach(ratio => document.getElementById('ratio').add(new Option(ratio, ratio))); |
document.getElementById('ratio').value = '16:9'; |
Attach a generate images function to the generate button and give a basic skeleton of the function , the exact logic i will handle, but essentially it will return a list of urls (for the generated images) |
We then need to display these images after the generate button |
[AI]: Sure, I'll attach a skeleton of the function to the "Generate" button for you. We'll add an event listener to the button that will call the function when the button is clicked. The function will then get the values from the form inputs and use them to generate the URLs. Finally, it will create new `img` elements ... |
Here's the updated JavaScript code: |
```javascript |
// Existing code... |
// ... |
// Add an event listener to the Generate button |
document.querySelector('.btn').addEventListener('click', generateImages); |
function generateImages() { |
// Get the values from the form inputs |
let provider = document.getElementById('provider').value; |
let model = document.getElementById('model').value; |
let style = document.getElementById('style').value; |
let ratio = document.getElementById('ratio').value; |
let numImages = document.getElementById('num-images').value; |
// Generate the URLs |
let urls = []; // replace this with the logic to generate the URLs |
for (let i = 0; i < numImages; i++) { |
// Add logic here to generate each URL based on the form values |
// For now, I'll just add a placeholder URL |
urls.push('http://example.com/image' + i + '.jpg'); |
} |
// Display the images |
let imageContainer = document.createElement('div'); |
imageContainer.style.display = 'flex'; |
imageContainer.style.flexWrap = 'wrap'; |
imageContainer.style.justifyContent = 'space-around'; |
urls.forEach(url => { |
let img = document.createElement('img'); |
img.src = url; |
img.style.width = '200px'; |
img.style.height = 'auto'; |
img.style.margin = '10px'; |
imageContainer.appendChild(img); |
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.