Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -142,7 +142,7 @@ def generate(logo=None, Vtubername=""):
|
|
142 |
|
143 |
japanese_text = hiragana
|
144 |
|
145 |
-
|
146 |
tile_width, tile_height = int(font_size*1.4), int(font_size*1.4) # Size of individual tiles
|
147 |
num_tiles = len(japanese_text)
|
148 |
total_width = tile_width * num_tiles
|
@@ -176,10 +176,10 @@ def generate(logo=None, Vtubername=""):
|
|
176 |
target_caption_height = int(logo_height)
|
177 |
|
178 |
if caption.width > target_caption_width:
|
179 |
-
aspect_ratio = caption.
|
180 |
-
new_width = int(
|
181 |
-
new_height = int(
|
182 |
-
|
183 |
resized_caption = caption.resize((new_width, new_height), Image.ANTIALIAS)
|
184 |
return resized_caption
|
185 |
else:
|
|
|
142 |
|
143 |
japanese_text = hiragana
|
144 |
|
145 |
+
# Image setup
|
146 |
tile_width, tile_height = int(font_size*1.4), int(font_size*1.4) # Size of individual tiles
|
147 |
num_tiles = len(japanese_text)
|
148 |
total_width = tile_width * num_tiles
|
|
|
176 |
target_caption_height = int(logo_height)
|
177 |
|
178 |
if caption.width > target_caption_width:
|
179 |
+
aspect_ratio = caption.width / target_caption_width
|
180 |
+
new_width = int(caption.width * aspect_ratio * 0.4)
|
181 |
+
new_height = int(caption.height * aspect_ratio * 0.4)
|
182 |
+
print("resizing")
|
183 |
resized_caption = caption.resize((new_width, new_height), Image.ANTIALIAS)
|
184 |
return resized_caption
|
185 |
else:
|