YSOAI / index.html
yassinovich's picture
Update index.html
7913bfb verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your App Name</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
background: white;
border-radius: 20px;
padding: 40px;
max-width: 600px;
width: 100%;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
h1 {
color: #333;
margin-bottom: 10px;
}
p {
color: #666;
margin-bottom: 30px;
}
input {
width: 100%;
padding: 15px;
border: 2px solid #e0e0e0;
border-radius: 10px;
font-size: 16px;
margin-bottom: 20px;
}
button {
width: 100%;
padding: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 10px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s;
}
button:hover {
transform: translateY(-2px);
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
}
#result {
margin-top: 30px;
padding: 20px;
background: #f5f5f5;
border-radius: 10px;
display: none;
}
#result img {
width: 100%;
border-radius: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>🎨 YSOAI IMAGE GENERATOR</h1>
<p>With YSOAI, Generate Image Fast</p>
<input
type="text"
id="prompt"
placeholder="Enter your prompt..."
value="a cool cat wearing sunglasses"
>
<button onclick="generate()">Generate</button>
<div id="result">
<h3>Result:</h3>
<img id="image" alt="Generated image">
</div>
</div>
<script>
async function generate() {
const prompt = document.getElementById('prompt').value;
const button = document.querySelector('button');
const result = document.getElementById('result');
const img = document.getElementById('image');
// Disable button while generating
button.disabled = true;
button.textContent = 'Generating...';
try {
// Example: Generate image with Pollinations
const imageUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(prompt)}`;
img.src = imageUrl;
result.style.display = 'block';
// Example: Generate text with Pollinations
// const response = await fetch('https://text.pollinations.ai/openai', {
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({
// messages: [{ role: 'user', content: prompt }],
// model: 'openai'
// })
// });
// const data = await response.json();
// console.log(data.choices[0].message.content);
} catch (error) {
alert('Error: ' + error.message);
} finally {
button.disabled = false;
button.textContent = 'Generate';
}
}
// Allow Enter key to submit
document.getElementById('prompt').addEventListener('keypress', (e) => {
if (e.key === 'Enter') generate();
});
</script>
</body>
</html>