Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
def get_image_size(aspect_ratio):
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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
|
145 |
-
choices=
|
146 |
-
value="
|
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",
|