daniel-dona commited on
Commit
51bd381
·
verified ·
1 Parent(s): 3210718

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -16
app.py CHANGED
@@ -25,20 +25,25 @@ MAX_SEED = np.iinfo(np.int32).max
25
 
26
  examples = json.loads(open("examples.json").read())
27
 
28
- # (1664, 928), (1472, 1140), (1328, 1328)
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  def get_image_size(aspect_ratio):
30
- if aspect_ratio == "1:1":
31
- return 1920, 1920
32
- elif aspect_ratio == "16:9":
33
- return 1920, 1080
34
- elif aspect_ratio == "9:16":
35
- return 1080, 1920
36
- elif aspect_ratio == "4:3":
37
- return 1920, 1440
38
- elif aspect_ratio == "3:4":
39
- return 1440, 1920
40
- else:
41
- return 640, 640
42
 
43
  def polish_prompt_en(original_prompt):
44
 
@@ -141,11 +146,13 @@ with gr.Blocks(css=css) as demo:
141
 
142
  with gr.Row():
143
  aspect_ratio = gr.Radio(
144
- label="Image size (ratio, max dim 1920)",
145
- choices=["1:1", "16:9", "9:16", "4:3", "3:4"],
146
- value="16:9",
147
  )
148
 
 
 
149
  with gr.Row():
150
  guidance_scale = gr.Slider(
151
  label="Guidance scale",
 
25
 
26
  examples = json.loads(open("examples.json").read())
27
 
28
+ aspect_ratios = {
29
+ "Big 1:1": (1080, 1080),
30
+ "Big 16:9": (1920, 1080),
31
+ "Big 9:16": (1080, 1920),
32
+ "Big 4:3": (1440, 1080),
33
+ "Big 3:4": (1080, 1440),
34
+
35
+ "Small 1:1": (720, 720),
36
+ "Small 16:9": (1280, 720),
37
+ "Small 9:16": (720, 1280),
38
+ "Small 4:3": (960, 720),
39
+ "Small 3:4": (720, 960),
40
+ }
41
+
42
  def get_image_size(aspect_ratio):
43
+
44
+
45
+
46
+ return aspect_ratios[aspect_ratio]
 
 
 
 
 
 
 
 
47
 
48
  def polish_prompt_en(original_prompt):
49
 
 
146
 
147
  with gr.Row():
148
  aspect_ratio = gr.Radio(
149
+ label="Image size",
150
+ choices=list(aspect_ratios.keys()),
151
+ value="Small 4:3",
152
  )
153
 
154
+
155
+
156
  with gr.Row():
157
  guidance_scale = gr.Slider(
158
  label="Guidance scale",