Spaces:
Running
Running
Sebastiankay
commited on
Commit
•
8c192f4
1
Parent(s):
152e3dd
Update app.py
Browse files
app.py
CHANGED
@@ -218,8 +218,8 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
|
|
218 |
with gr.Row():
|
219 |
select_model = gr.Dropdown(choices=["FLUX-API-OLD", "FLUX", "FLUX-Realism", "FLUX-Pixel", "FLUX-Anime", "FLUX-3D", "FLUX-Disney", "ANY-DARK", "Stable-Diffusion-XL-Base", "Stable-Diffusion-XL-Lightning"], value="FLUX", label="Model", elem_id="select_model", elem_classes="select-model")
|
220 |
# with gr.Row():
|
221 |
-
image_width = gr.Number(label="Breite", minimum=256, maximum=MAX_IMAGE_SIZE, value=
|
222 |
-
image_height = gr.Number(label="Höhe", minimum=256, maximum=MAX_IMAGE_SIZE, value=
|
223 |
with gr.Row():
|
224 |
image_ratio_buttons = gr.Radio(["9:16", "3:4", "2:3", "1:1"], value="9:16", label="Hochformat", show_label=True, info="Die gängigsten Seitenverhältnissen.", interactive=True, elem_id="image_ratio_buttons", elem_classes="image-ratio-buttons", container=True, scale=2)
|
225 |
switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
|
@@ -272,20 +272,20 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
|
|
272 |
def calculate_ratio_values(image_ratio_buttons):
|
273 |
ratio_value = image_ratio_buttons.split(":")
|
274 |
if int(ratio_value[0]) > int(ratio_value[1]):
|
275 |
-
a =
|
276 |
b = int(a * int(ratio_value[1]) / int(ratio_value[0]))
|
277 |
new_width = a
|
278 |
new_height = b
|
279 |
new_label = "Querformat"
|
280 |
elif int(ratio_value[0]) < int(ratio_value[1]):
|
281 |
-
b =
|
282 |
a = int(b * int(ratio_value[0]) / int(ratio_value[1]))
|
283 |
new_width = a
|
284 |
new_height = b
|
285 |
new_label = "Hochformat"
|
286 |
elif int(ratio_value[0]) == int(ratio_value[1]):
|
287 |
-
new_width =
|
288 |
-
new_height =
|
289 |
new_label = "Quadratisch"
|
290 |
|
291 |
return {"label": new_label, "__type__": "update"}, new_width, new_height
|
@@ -303,5 +303,6 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
|
|
303 |
|
304 |
enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt], show_api=False)
|
305 |
random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt], show_api=False)
|
|
|
306 |
# MARK: Gradio LAUNCH
|
307 |
demo.launch(show_api=False)
|
|
|
218 |
with gr.Row():
|
219 |
select_model = gr.Dropdown(choices=["FLUX-API-OLD", "FLUX", "FLUX-Realism", "FLUX-Pixel", "FLUX-Anime", "FLUX-3D", "FLUX-Disney", "ANY-DARK", "Stable-Diffusion-XL-Base", "Stable-Diffusion-XL-Lightning"], value="FLUX", label="Model", elem_id="select_model", elem_classes="select-model")
|
220 |
# with gr.Row():
|
221 |
+
image_width = gr.Number(label="Breite", minimum=256, maximum=MAX_IMAGE_SIZE, value=576, step=32, elem_id="image_width_selector", elem_classes="image-width-selector", scale=1, visible=False)
|
222 |
+
image_height = gr.Number(label="Höhe", minimum=256, maximum=MAX_IMAGE_SIZE, value=1024, step=32, elem_id="image_height_selector", elem_classes="image-height-selector", scale=1, visible=False)
|
223 |
with gr.Row():
|
224 |
image_ratio_buttons = gr.Radio(["9:16", "3:4", "2:3", "1:1"], value="9:16", label="Hochformat", show_label=True, info="Die gängigsten Seitenverhältnissen.", interactive=True, elem_id="image_ratio_buttons", elem_classes="image-ratio-buttons", container=True, scale=2)
|
225 |
switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
|
|
|
272 |
def calculate_ratio_values(image_ratio_buttons):
|
273 |
ratio_value = image_ratio_buttons.split(":")
|
274 |
if int(ratio_value[0]) > int(ratio_value[1]):
|
275 |
+
a = 1024
|
276 |
b = int(a * int(ratio_value[1]) / int(ratio_value[0]))
|
277 |
new_width = a
|
278 |
new_height = b
|
279 |
new_label = "Querformat"
|
280 |
elif int(ratio_value[0]) < int(ratio_value[1]):
|
281 |
+
b = 1024
|
282 |
a = int(b * int(ratio_value[0]) / int(ratio_value[1]))
|
283 |
new_width = a
|
284 |
new_height = b
|
285 |
new_label = "Hochformat"
|
286 |
elif int(ratio_value[0]) == int(ratio_value[1]):
|
287 |
+
new_width = 1024
|
288 |
+
new_height = 1024
|
289 |
new_label = "Quadratisch"
|
290 |
|
291 |
return {"label": new_label, "__type__": "update"}, new_width, new_height
|
|
|
303 |
|
304 |
enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt], show_api=False)
|
305 |
random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt], show_api=False)
|
306 |
+
|
307 |
# MARK: Gradio LAUNCH
|
308 |
demo.launch(show_api=False)
|