Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
e3c4ecf
1
Parent(s):
f6d599f
Add random seed parameter to image generation URL for enhanced variability
Browse files
FLUX.py
CHANGED
@@ -4,6 +4,7 @@ import io
|
|
4 |
import os
|
5 |
import re
|
6 |
import json
|
|
|
7 |
from PIL import Image, UnidentifiedImageError
|
8 |
|
9 |
# Load the ImgBB API key from the environment variables.
|
@@ -57,8 +58,8 @@ def generate_image(prompt, request_id, current_request_id, image_dir, attempt=0)
|
|
57 |
model = "flux"
|
58 |
width = 1920
|
59 |
height = 1080
|
60 |
-
|
61 |
-
url = f"https://image.pollinations.ai/prompt/{prompt}?nologo=true&safe=false&private=true&model={model}&enhance=
|
62 |
print(f"Attempt {attempt + 1}: Fetching image with URL: {url}")
|
63 |
|
64 |
try:
|
|
|
4 |
import os
|
5 |
import re
|
6 |
import json
|
7 |
+
import random
|
8 |
from PIL import Image, UnidentifiedImageError
|
9 |
|
10 |
# Load the ImgBB API key from the environment variables.
|
|
|
58 |
model = "flux"
|
59 |
width = 1920
|
60 |
height = 1080
|
61 |
+
randomSeed = random.randint(0, 999999)
|
62 |
+
url = f"https://image.pollinations.ai/prompt/{prompt}?nologo=true&safe=false&private=true&model={model}&enhance=true&width={width}&height={height}&seed={randomSeed}"
|
63 |
print(f"Attempt {attempt + 1}: Fetching image with URL: {url}")
|
64 |
|
65 |
try:
|