Sebastiankay commited on
Commit
dfde46b
1 Parent(s): f8e211d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -250,10 +250,10 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
250
  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)
251
  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)
252
  with gr.Row():
253
- 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)
254
  switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
255
  with gr.Column():
256
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True, elem_classes="random-seed-cb")
257
  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)
258
 
259
  with gr.Column(scale=4): # min_width=600,
@@ -303,12 +303,14 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
303
  if int(ratio_value[0]) > int(ratio_value[1]):
304
  a = 1024
305
  b = int(a * int(ratio_value[1]) / int(ratio_value[0]))
 
306
  new_width = a
307
  new_height = b
308
  new_label = "Querformat"
309
  elif int(ratio_value[0]) < int(ratio_value[1]):
310
  b = 1024
311
  a = int(b * int(ratio_value[0]) / int(ratio_value[1]))
 
312
  new_width = a
313
  new_height = b
314
  new_label = "Hochformat"
 
250
  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)
251
  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)
252
  with gr.Row():
253
+ image_ratio_buttons = gr.Radio(["9:16", "3:4", "2:3", "1:1"], value="9:16", label="Hochformat", show_label=True, info="Seitenverhältniss drehen", interactive=True, elem_id="image_ratio_buttons", elem_classes="image-ratio-buttons", container=True, scale=2)
254
  switch_width_height = gr.Button("", size="sm", elem_id="switch_width_height", elem_classes="switch-ratio-btn", variant="primary", scale=1)
255
  with gr.Column():
256
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True, elem_classes="random-seed-cb toggle-btn")
257
  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)
258
 
259
  with gr.Column(scale=4): # min_width=600,
 
303
  if int(ratio_value[0]) > int(ratio_value[1]):
304
  a = 1024
305
  b = int(a * int(ratio_value[1]) / int(ratio_value[0]))
306
+ b = round(b / 8) * 8
307
  new_width = a
308
  new_height = b
309
  new_label = "Querformat"
310
  elif int(ratio_value[0]) < int(ratio_value[1]):
311
  b = 1024
312
  a = int(b * int(ratio_value[0]) / int(ratio_value[1]))
313
+ a = round(a / 8) * 8
314
  new_width = a
315
  new_height = b
316
  new_label = "Hochformat"