Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ TEMPLATE = (
|
|
49 |
#
|
50 |
"<|rating:general|>"
|
51 |
"{aspect_ratio}"
|
52 |
-
"<|length:
|
53 |
#
|
54 |
"<copyright></copyright>"
|
55 |
#
|
@@ -57,8 +57,8 @@ TEMPLATE = (
|
|
57 |
#
|
58 |
"<general>{subject}"
|
59 |
)
|
60 |
-
QUALITY_TAGS = "
|
61 |
-
NEGATIVE_PROMPT = "
|
62 |
BAN_TAGS = [
|
63 |
"photoshop (medium)",
|
64 |
"clip studio paint (medium)",
|
@@ -126,18 +126,22 @@ else:
|
|
126 |
|
127 |
|
128 |
def get_aspect_ratio(width: int, height: int) -> str:
|
129 |
-
ar = width / height
|
130 |
|
131 |
-
if ar <= 1
|
132 |
-
return "<|aspect_ratio:
|
133 |
-
elif ar <=
|
|
|
|
|
134 |
return "<|aspect_ratio:tall|>"
|
135 |
-
elif ar <
|
136 |
return "<|aspect_ratio:square|>"
|
137 |
-
elif ar <
|
138 |
return "<|aspect_ratio:wide|>"
|
|
|
|
|
139 |
else:
|
140 |
-
return "<|aspect_ratio:
|
141 |
|
142 |
|
143 |
@torch.inference_mode
|
|
|
49 |
#
|
50 |
"<|rating:general|>"
|
51 |
"{aspect_ratio}"
|
52 |
+
"<|length:medium|>"
|
53 |
#
|
54 |
"<copyright></copyright>"
|
55 |
#
|
|
|
57 |
#
|
58 |
"<general>{subject}"
|
59 |
)
|
60 |
+
QUALITY_TAGS = ""
|
61 |
+
NEGATIVE_PROMPT = "bad quality, worst quality, lowres, bad anatomy, sketch, jpeg artifacts, ugly, poorly drawn, signature, watermark, bad anatomy, bad hands, bad feet, retro, old, 2000s, 2010s, 2011s, 2012s, 2013s, multiple views, 3d, screencap"
|
62 |
BAN_TAGS = [
|
63 |
"photoshop (medium)",
|
64 |
"clip studio paint (medium)",
|
|
|
126 |
|
127 |
|
128 |
def get_aspect_ratio(width: int, height: int) -> str:
|
129 |
+
ar = math.log2(width / height)
|
130 |
|
131 |
+
if ar <= -1.25:
|
132 |
+
return "<|aspect_ratio:too_tall|>"
|
133 |
+
elif ar <= -0.75:
|
134 |
+
return "<|aspect_ratio:tall_wallpaper|>"
|
135 |
+
elif ar <= -0.25:
|
136 |
return "<|aspect_ratio:tall|>"
|
137 |
+
elif ar < 0.25:
|
138 |
return "<|aspect_ratio:square|>"
|
139 |
+
elif ar < 0.75:
|
140 |
return "<|aspect_ratio:wide|>"
|
141 |
+
elif ar < 1.25:
|
142 |
+
return "<|aspect_ratio:wide_wallpaper|>"
|
143 |
else:
|
144 |
+
return "<|aspect_ratio:too_wide|>"
|
145 |
|
146 |
|
147 |
@torch.inference_mode
|