Spaces:
Running
Running
Sebastiankay
commited on
Commit
•
88292ed
1
Parent(s):
92e1468
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,8 @@ from io import BytesIO
|
|
14 |
import colorsys
|
15 |
|
16 |
# MARK: INIT
|
17 |
-
MAX_SEED = np.iinfo(np.int32).max
|
|
|
18 |
MAX_IMAGE_SIZE = 2048
|
19 |
|
20 |
GROQ_APIKEY_PROMPTENHANCE = os.getenv("GROQ_APIKEY_PROMPTENHANCE")
|
@@ -162,7 +163,7 @@ def process(Prompt, used_model, image_width, image_height, image_ratio, image_se
|
|
162 |
|
163 |
timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
164 |
filename_prompt = re.sub(r"[^\w\s-]", "", Prompt).strip().replace(" ", "_")
|
165 |
-
filename = timestamp + "_" + filename_prompt[:100] + ".
|
166 |
file_path = os.path.join(IMAGE_DIR, filename)
|
167 |
|
168 |
# Retry-Logik mit requests und Retry
|
@@ -182,7 +183,7 @@ def process(Prompt, used_model, image_width, image_height, image_ratio, image_se
|
|
182 |
print("Imagine API Request solved")
|
183 |
print("Save image to: " + file_path)
|
184 |
img = PILImage.open(BytesIO(response.content))
|
185 |
-
img.save(file_path, "
|
186 |
|
187 |
# img_exif_comment = "" # read_exif(file_path)
|
188 |
img_dominant_color = image_get_dominant_color(file_path)
|
@@ -225,7 +226,7 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
|
|
225 |
switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
|
226 |
with gr.Column():
|
227 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True, elem_classes="random-seed-cb")
|
228 |
-
image_seed = gr.Slider(label="Seed", info="Jeder Seed generiert ein anderes Bild mit dem selben Prompt", minimum=0, step=1, value=
|
229 |
|
230 |
with gr.Column(scale=4): # min_width=600,
|
231 |
with gr.Row():
|
|
|
14 |
import colorsys
|
15 |
|
16 |
# MARK: INIT
|
17 |
+
# MAX_SEED = np.iinfo(np.int32).max
|
18 |
+
MAX_SEED = 9999
|
19 |
MAX_IMAGE_SIZE = 2048
|
20 |
|
21 |
GROQ_APIKEY_PROMPTENHANCE = os.getenv("GROQ_APIKEY_PROMPTENHANCE")
|
|
|
163 |
|
164 |
timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
165 |
filename_prompt = re.sub(r"[^\w\s-]", "", Prompt).strip().replace(" ", "_")
|
166 |
+
filename = timestamp + "_" + filename_prompt[:100] + ".png"
|
167 |
file_path = os.path.join(IMAGE_DIR, filename)
|
168 |
|
169 |
# Retry-Logik mit requests und Retry
|
|
|
183 |
print("Imagine API Request solved")
|
184 |
print("Save image to: " + file_path)
|
185 |
img = PILImage.open(BytesIO(response.content))
|
186 |
+
img.save(file_path, "PNG")
|
187 |
|
188 |
# img_exif_comment = "" # read_exif(file_path)
|
189 |
img_dominant_color = image_get_dominant_color(file_path)
|
|
|
226 |
switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
|
227 |
with gr.Column():
|
228 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True, elem_classes="random-seed-cb")
|
229 |
+
image_seed = gr.Slider(label="Seed", info="Jeder Seed generiert ein anderes Bild mit dem selben Prompt", minimum=0, step=1, value=42, maximum=MAX_SEED, elem_id="image_seed", elem_classes="image-seed hide-progress", interactive=False)
|
230 |
|
231 |
with gr.Column(scale=4): # min_width=600,
|
232 |
with gr.Row():
|