Spaces:
Paused
Paused
commit
Browse files
app.py
CHANGED
|
@@ -176,22 +176,22 @@ def handle_generate(artist,song,genre,lyrics):
|
|
| 176 |
draw = ImageDraw.Draw(img)
|
| 177 |
|
| 178 |
rows = 1
|
| 179 |
-
labes_distance = math.
|
| 180 |
|
| 181 |
-
textheight=min(math.
|
| 182 |
font = ImageFont.truetype(r"Alef-Bold.ttf", textheight)
|
| 183 |
textwidth = draw.textlength(pos_song,font)
|
| 184 |
-
x = math.
|
| 185 |
-
y = math.
|
| 186 |
-
y = y - math.
|
| 187 |
draw.text((x, y), pos_song, (255,255,255), font=font)
|
| 188 |
|
| 189 |
-
textheight=min(math.
|
| 190 |
font = ImageFont.truetype(r"Alef-Bold.ttf", textheight)
|
| 191 |
textwidth = draw.textlength(pos_artist,font)
|
| 192 |
-
x = math.
|
| 193 |
-
y = math.
|
| 194 |
-
y = y + math.
|
| 195 |
draw.text((x, y), pos_artist, (255,255,255), font=font)
|
| 196 |
|
| 197 |
name = generate_random_string(12) + ".png"
|
|
|
|
| 176 |
draw = ImageDraw.Draw(img)
|
| 177 |
|
| 178 |
rows = 1
|
| 179 |
+
labes_distance = math.ceil(1 / 3)
|
| 180 |
|
| 181 |
+
textheight=min(math.ceil( width / 10 ), math.ceil( height / 5 ))
|
| 182 |
font = ImageFont.truetype(r"Alef-Bold.ttf", textheight)
|
| 183 |
textwidth = draw.textlength(pos_song,font)
|
| 184 |
+
x = math.ceil((width - textwidth) / 2)
|
| 185 |
+
y = math.ceil((height - math.ceil(textheight * rows / 2)) / 2)
|
| 186 |
+
y = y - math.ceil(y / labes_distance)
|
| 187 |
draw.text((x, y), pos_song, (255,255,255), font=font)
|
| 188 |
|
| 189 |
+
textheight=min(math.ceil( width / 12 ), math.ceil( height / 6 ))
|
| 190 |
font = ImageFont.truetype(r"Alef-Bold.ttf", textheight)
|
| 191 |
textwidth = draw.textlength(pos_artist,font)
|
| 192 |
+
x = math.ceil((width - textwidth) / 2)
|
| 193 |
+
y = math.ceil((height - math.ceil(textheight * rows / 2)) / 2)
|
| 194 |
+
y = y + math.ceil(y / labes_distance)
|
| 195 |
draw.text((x, y), pos_artist, (255,255,255), font=font)
|
| 196 |
|
| 197 |
name = generate_random_string(12) + ".png"
|