Spaces:
Sleeping
Sleeping
Ron Au
commited on
Commit
•
69c5e48
1
Parent(s):
d838a09
fix: Fix Dict types
Browse files- modules/sprites.py +6 -6
modules/sprites.py
CHANGED
@@ -4,7 +4,7 @@ import re
|
|
4 |
import time
|
5 |
import random
|
6 |
import torch
|
7 |
-
from typing import Final, List, Optional, Tuple, cast
|
8 |
|
9 |
from PIL import Image, ImageDraw, ImageEnhance
|
10 |
from PIL.Image import Image as PILImage
|
@@ -63,8 +63,8 @@ def generate(
|
|
63 |
|
64 |
|
65 |
def generate_sides(
|
66 |
-
prompt: str, sfw_retries: int = 1, sides:
|
67 |
-
) -> Tuple[
|
68 |
"""
|
69 |
Generate sprite images from a text description of different sides.
|
70 |
|
@@ -166,7 +166,7 @@ def split_sprites(image: PILImage, size: Tuple[int, int] = (96, 96)) -> List[PIL
|
|
166 |
|
167 |
|
168 |
def build_spritesheet(
|
169 |
-
images:
|
170 |
text: str = "sd_pixelart",
|
171 |
sprite_size: Tuple[int, int] = (96, 96),
|
172 |
dir: str = "output",
|
@@ -222,14 +222,14 @@ def build_spritesheet(
|
|
222 |
|
223 |
|
224 |
def build_gifs(
|
225 |
-
images:
|
226 |
text: str = "sd_spritesheet",
|
227 |
dir: str = "output",
|
228 |
duration: int | List[int] | Tuple[int, ...] = (300, 450, 300, 450),
|
229 |
save: bool = False,
|
230 |
timestamp: Optional[int] = None,
|
231 |
thresh: int = 128,
|
232 |
-
) -> Tuple[
|
233 |
"""Build animated GIFs from side frames."""
|
234 |
|
235 |
gifs = {}
|
|
|
4 |
import time
|
5 |
import random
|
6 |
import torch
|
7 |
+
from typing import Dict, Final, List, Optional, Tuple, cast
|
8 |
|
9 |
from PIL import Image, ImageDraw, ImageEnhance
|
10 |
from PIL.Image import Image as PILImage
|
|
|
63 |
|
64 |
|
65 |
def generate_sides(
|
66 |
+
prompt: str, sfw_retries: int = 1, sides: Dict[str, str] = sprite_sides
|
67 |
+
) -> Tuple[Dict[str, PILImage], str]:
|
68 |
"""
|
69 |
Generate sprite images from a text description of different sides.
|
70 |
|
|
|
166 |
|
167 |
|
168 |
def build_spritesheet(
|
169 |
+
images: Dict[str, PILImage],
|
170 |
text: str = "sd_pixelart",
|
171 |
sprite_size: Tuple[int, int] = (96, 96),
|
172 |
dir: str = "output",
|
|
|
222 |
|
223 |
|
224 |
def build_gifs(
|
225 |
+
images: Dict[str, PILImage],
|
226 |
text: str = "sd_spritesheet",
|
227 |
dir: str = "output",
|
228 |
duration: int | List[int] | Tuple[int, ...] = (300, 450, 300, 450),
|
229 |
save: bool = False,
|
230 |
timestamp: Optional[int] = None,
|
231 |
thresh: int = 128,
|
232 |
+
) -> Tuple[Dict[str, List[PILImage]], List[str] | None]:
|
233 |
"""Build animated GIFs from side frames."""
|
234 |
|
235 |
gifs = {}
|