Spaces:
Running
Running
sey up pollinations api img2img ## Pollinations.AI Cheatsheet for Coding Assistants
Browse files### Image Generation
Generate Image: `GET https://image.pollinations.ai/prompt/{prompt}`
### Image Models
List Models: `GET https://image.pollinations.ai/models`
### Text Generation
Generate (GET): `GET https://text.pollinations.ai/{prompt}`
### Text Generation (Advanced)
Generate (POST): `POST https://text.pollinations.ai/`
### Audio Generation
Generate Audio: `GET https://text.pollinations.ai/{prompt}?model=openai-audio&voice={voice}`
### OpenAI Compatible Endpoint
OpenAI Compatible: `POST https://text.pollinations.ai/openai`
### Text Models
List Models: `GET https://text.pollinations.ai/models`
### Real-time Feeds
Image Feed: `GET https://image.pollinations.ai/feed`
Text Feed: `GET https://text.pollinations.ai/feed`
*\* required parameter*
- index.html +55 -6
index.html
CHANGED
|
@@ -101,16 +101,37 @@
|
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
</section>
|
| 104 |
-
<!-- Demo Section -->
|
| 105 |
<section id="demo" class="py-20 bg-gray-900">
|
| 106 |
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 107 |
<div class="text-center mb-16">
|
| 108 |
<h2 class="text-3xl md:text-4xl font-bold mb-4">Pop Art Creations</h2>
|
| 109 |
<p class="text-xl text-gray-400 max-w-3xl mx-auto">Explore our vibrant pop art designs and create your own masterpieces</p>
|
| 110 |
-
</div>
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 113 |
-
|
| 114 |
<img src="http://static.photos/nature/1024x576/1" alt="Nature Panorama" class="w-full h-64 object-cover">
|
| 115 |
<div class="p-6">
|
| 116 |
<h3 class="text-xl font-semibold mb-2">Colorful Portraits</h3>
|
|
@@ -354,10 +375,38 @@
|
|
| 354 |
</div>
|
| 355 |
</div>
|
| 356 |
</footer>
|
| 357 |
-
|
| 358 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
// Initialize Vanta.js
|
| 360 |
-
|
| 361 |
el: "#vanta-bg",
|
| 362 |
mouseControls: true,
|
| 363 |
touchControls: true,
|
|
|
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
</section>
|
| 104 |
+
<!-- Demo Section -->
|
| 105 |
<section id="demo" class="py-20 bg-gray-900">
|
| 106 |
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 107 |
<div class="text-center mb-16">
|
| 108 |
<h2 class="text-3xl md:text-4xl font-bold mb-4">Pop Art Creations</h2>
|
| 109 |
<p class="text-xl text-gray-400 max-w-3xl mx-auto">Explore our vibrant pop art designs and create your own masterpieces</p>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<!-- Image Generation Form -->
|
| 113 |
+
<div class="bg-gray-800 rounded-xl p-6 mb-12 max-w-3xl mx-auto">
|
| 114 |
+
<h3 class="text-xl font-semibold mb-4 flex items-center">
|
| 115 |
+
<i data-feather="image" class="mr-2 text-indigo-400"></i> Generate Your Own Pop Art
|
| 116 |
+
</h3>
|
| 117 |
+
<div class="flex gap-4 mb-4">
|
| 118 |
+
<input type="text" id="promptInput" placeholder="Describe your pop art design..."
|
| 119 |
+
class="flex-1 bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 120 |
+
<button onclick="generateImage()" class="bg-indigo-600 hover:bg-indigo-700 px-6 py-2 rounded-lg font-medium flex items-center">
|
| 121 |
+
<i data-feather="zap" class="mr-2"></i> Generate
|
| 122 |
+
</button>
|
| 123 |
+
</div>
|
| 124 |
+
<div id="generatedImageContainer" class="mt-4">
|
| 125 |
+
<img id="generatedImage" class="w-full rounded-lg hidden" alt="Generated pop art">
|
| 126 |
+
<div id="loadingSpinner" class="text-center py-8 hidden">
|
| 127 |
+
<i data-feather="loader" class="animate-spin w-12 h-12 mx-auto text-indigo-400"></i>
|
| 128 |
+
<p class="mt-2 text-gray-400">Generating your pop art masterpiece...</p>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
<!-- Gallery Section -->
|
| 133 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 134 |
+
<div class="bg-gray-800 rounded-xl overflow-hidden transition-all hover:scale-105">
|
| 135 |
<img src="http://static.photos/nature/1024x576/1" alt="Nature Panorama" class="w-full h-64 object-cover">
|
| 136 |
<div class="p-6">
|
| 137 |
<h3 class="text-xl font-semibold mb-2">Colorful Portraits</h3>
|
|
|
|
| 375 |
</div>
|
| 376 |
</div>
|
| 377 |
</footer>
|
|
|
|
| 378 |
<script>
|
| 379 |
+
// Image Generation Function
|
| 380 |
+
function generateImage() {
|
| 381 |
+
const prompt = document.getElementById('promptInput').value;
|
| 382 |
+
if (!prompt) return;
|
| 383 |
+
|
| 384 |
+
const imageContainer = document.getElementById('generatedImageContainer');
|
| 385 |
+
const generatedImage = document.getElementById('generatedImage');
|
| 386 |
+
const loadingSpinner = document.getElementById('loadingSpinner');
|
| 387 |
+
|
| 388 |
+
// Show loading spinner
|
| 389 |
+
generatedImage.classList.add('hidden');
|
| 390 |
+
loadingSpinner.classList.remove('hidden');
|
| 391 |
+
|
| 392 |
+
// Generate image via Pollinations.AI
|
| 393 |
+
const promptText = `Vibrant professional graphic design in a pop art style of: ${prompt}`;
|
| 394 |
+
const encodedPrompt = encodeURIComponent(promptText);
|
| 395 |
+
const imageUrl = `https://image.pollinations.ai/prompt/${encodedPrompt}?width=1024&height=576`;
|
| 396 |
+
|
| 397 |
+
generatedImage.src = imageUrl;
|
| 398 |
+
generatedImage.onload = function() {
|
| 399 |
+
loadingSpinner.classList.add('hidden');
|
| 400 |
+
generatedImage.classList.remove('hidden');
|
| 401 |
+
};
|
| 402 |
+
generatedImage.onerror = function() {
|
| 403 |
+
loadingSpinner.classList.add('hidden');
|
| 404 |
+
alert('Failed to generate image. Please try again with a different prompt.');
|
| 405 |
+
};
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
// Initialize Vanta.js
|
| 409 |
+
VANTA.GLOBE({
|
| 410 |
el: "#vanta-bg",
|
| 411 |
mouseControls: true,
|
| 412 |
touchControls: true,
|