Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub (part 3)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +64 -0
- memes/confuse/images/84.png +0 -0
- memes/confuse/images/85.png +0 -0
- memes/confuse/images/86.png +0 -0
- memes/confuse/images/87.png +0 -0
- memes/confuse/images/88.png +0 -0
- memes/confuse/images/89.png +0 -0
- memes/confuse/images/9.png +0 -0
- memes/confuse/images/90.png +0 -0
- memes/confuse/images/91.png +0 -0
- memes/confuse/images/92.png +0 -0
- memes/confuse/images/93.png +0 -0
- memes/confuse/images/94.png +0 -0
- memes/confuse/images/95.png +0 -0
- memes/confuse/images/96.png +0 -0
- memes/confuse/images/97.png +0 -0
- memes/confuse/images/98.png +0 -0
- memes/confuse/images/99.png +0 -0
- memes/coupon/__init__.py +45 -0
- memes/coupon/images/0.png +3 -0
- memes/cover_face/__init__.py +27 -0
- memes/cover_face/images/0.png +3 -0
- memes/crawl/__init__.py +63 -0
- memes/crawl/images/01.jpg +0 -0
- memes/crawl/images/02.jpg +3 -0
- memes/crawl/images/03.jpg +3 -0
- memes/crawl/images/04.jpg +0 -0
- memes/crawl/images/05.jpg +0 -0
- memes/crawl/images/06.jpg +0 -0
- memes/crawl/images/07.jpg +0 -0
- memes/crawl/images/08.jpg +0 -0
- memes/crawl/images/09.jpg +0 -0
- memes/crawl/images/10.jpg +0 -0
- memes/crawl/images/11.jpg +0 -0
- memes/crawl/images/12.jpg +0 -0
- memes/crawl/images/13.jpg +3 -0
- memes/crawl/images/14.jpg +0 -0
- memes/crawl/images/15.jpg +0 -0
- memes/crawl/images/16.jpg +0 -0
- memes/crawl/images/17.jpg +0 -0
- memes/crawl/images/18.jpg +0 -0
- memes/crawl/images/19.jpg +0 -0
- memes/crawl/images/20.jpg +0 -0
- memes/crawl/images/21.jpg +0 -0
- memes/crawl/images/22.jpg +0 -0
- memes/crawl/images/23.jpg +0 -0
- memes/crawl/images/24.jpg +0 -0
- memes/crawl/images/25.jpg +0 -0
- memes/crawl/images/26.jpg +0 -0
- memes/crawl/images/27.jpg +0 -0
.gitattributes
CHANGED
|
@@ -92,3 +92,67 @@ memes/clown/images/circle.png filter=lfs diff=lfs merge=lfs -text
|
|
| 92 |
memes/clown/images/person.png filter=lfs diff=lfs merge=lfs -text
|
| 93 |
memes/clown_mask/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 94 |
memes/clown_mask/images/1.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
memes/clown/images/person.png filter=lfs diff=lfs merge=lfs -text
|
| 93 |
memes/clown_mask/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 94 |
memes/clown_mask/images/1.png filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
memes/coupon/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
memes/cover_face/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
memes/crawl/images/02.jpg filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
memes/crawl/images/03.jpg filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
memes/crawl/images/13.jpg filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
memes/crawl/images/31.jpg filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
memes/crawl/images/32.jpg filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
memes/crawl/images/33.jpg filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
memes/crawl/images/36.jpg filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
memes/crawl/images/37.jpg filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
memes/crawl/images/47.jpg filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
memes/crawl/images/51.jpg filter=lfs diff=lfs merge=lfs -text
|
| 107 |
+
memes/crawl/images/58.jpg filter=lfs diff=lfs merge=lfs -text
|
| 108 |
+
memes/crawl/images/59.jpg filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
memes/crawl/images/61.jpg filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
memes/crawl/images/62.jpg filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
memes/crawl/images/63.jpg filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
memes/crawl/images/65.jpg filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
memes/crawl/images/66.jpg filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
memes/crawl/images/71.jpg filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
memes/crawl/images/74.jpg filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
memes/crawl/images/75.jpg filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
memes/crawl/images/76.jpg filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
memes/crawl/images/79.jpg filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
memes/crawl/images/80.jpg filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
memes/crawl/images/82.jpg filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
memes/crawl/images/84.jpg filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
memes/crawl/images/85.jpg filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
memes/crawl/images/86.jpg filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
memes/crawl/images/87.jpg filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
memes/crawl/images/88.jpg filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
memes/crawl/images/91.jpg filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
memes/decent_kiss/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
memes/dinosaur/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
memes/divorce/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
memes/dog_of_vtb/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
memes/dont_go_near/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
memes/dont_press/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
memes/dont_touch/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
memes/emperor_dragon/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
memes/erised_mirror/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 136 |
+
memes/father_work/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 137 |
+
memes/fight_with_sunuo/images/0.png filter=lfs diff=lfs merge=lfs -text
|
| 138 |
+
memes/firefly_holdsign/images/01.png filter=lfs diff=lfs merge=lfs -text
|
| 139 |
+
memes/firefly_holdsign/images/02.png filter=lfs diff=lfs merge=lfs -text
|
| 140 |
+
memes/firefly_holdsign/images/03.png filter=lfs diff=lfs merge=lfs -text
|
| 141 |
+
memes/firefly_holdsign/images/04.png filter=lfs diff=lfs merge=lfs -text
|
| 142 |
+
memes/firefly_holdsign/images/05.png filter=lfs diff=lfs merge=lfs -text
|
| 143 |
+
memes/firefly_holdsign/images/06.png filter=lfs diff=lfs merge=lfs -text
|
| 144 |
+
memes/firefly_holdsign/images/07.png filter=lfs diff=lfs merge=lfs -text
|
| 145 |
+
memes/firefly_holdsign/images/08.png filter=lfs diff=lfs merge=lfs -text
|
| 146 |
+
memes/firefly_holdsign/images/09.png filter=lfs diff=lfs merge=lfs -text
|
| 147 |
+
memes/firefly_holdsign/images/10.png filter=lfs diff=lfs merge=lfs -text
|
| 148 |
+
memes/firefly_holdsign/images/11.png filter=lfs diff=lfs merge=lfs -text
|
| 149 |
+
memes/firefly_holdsign/images/12.png filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
memes/firefly_holdsign/images/13.png filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
memes/firefly_holdsign/images/14.png filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
memes/firefly_holdsign/images/15.png filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
memes/firefly_holdsign/images/16.png filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
memes/firefly_holdsign/images/17.png filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
memes/firefly_holdsign/images/18.png filter=lfs diff=lfs merge=lfs -text
|
| 156 |
+
memes/firefly_holdsign/images/19.png filter=lfs diff=lfs merge=lfs -text
|
| 157 |
+
memes/firefly_holdsign/images/20.png filter=lfs diff=lfs merge=lfs -text
|
| 158 |
+
memes/firefly_holdsign/images/21.png filter=lfs diff=lfs merge=lfs -text
|
memes/confuse/images/84.png
ADDED
|
memes/confuse/images/85.png
ADDED
|
memes/confuse/images/86.png
ADDED
|
memes/confuse/images/87.png
ADDED
|
memes/confuse/images/88.png
ADDED
|
memes/confuse/images/89.png
ADDED
|
memes/confuse/images/9.png
ADDED
|
memes/confuse/images/90.png
ADDED
|
memes/confuse/images/91.png
ADDED
|
memes/confuse/images/92.png
ADDED
|
memes/confuse/images/93.png
ADDED
|
memes/confuse/images/94.png
ADDED
|
memes/confuse/images/95.png
ADDED
|
memes/confuse/images/96.png
ADDED
|
memes/confuse/images/97.png
ADDED
|
memes/confuse/images/98.png
ADDED
|
memes/confuse/images/99.png
ADDED
|
memes/coupon/__init__.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
from pil_utils import BuildImage
|
| 5 |
+
|
| 6 |
+
from meme_generator import MemeArgsModel, add_meme
|
| 7 |
+
from meme_generator.exception import TextOverLength
|
| 8 |
+
|
| 9 |
+
img_dir = Path(__file__).parent / "images"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def coupon(images: list[BuildImage], texts: list[str], args: MemeArgsModel):
|
| 13 |
+
img = images[0].convert("RGBA").circle().resize((60, 60))
|
| 14 |
+
name = args.user_infos[0].name if args.user_infos else ""
|
| 15 |
+
text = (texts[0] if texts else f"{name}陪睡券") + "\n(永久有效)"
|
| 16 |
+
|
| 17 |
+
text_img = BuildImage.new("RGBA", (250, 100))
|
| 18 |
+
try:
|
| 19 |
+
text_img.draw_text(
|
| 20 |
+
(0, 0, text_img.width, text_img.height),
|
| 21 |
+
text,
|
| 22 |
+
lines_align="center",
|
| 23 |
+
max_fontsize=30,
|
| 24 |
+
min_fontsize=15,
|
| 25 |
+
)
|
| 26 |
+
except ValueError:
|
| 27 |
+
raise TextOverLength(text)
|
| 28 |
+
|
| 29 |
+
frame = BuildImage.open(img_dir / "0.png")
|
| 30 |
+
frame.paste(img.rotate(22, expand=True), (164, 85), alpha=True)
|
| 31 |
+
frame.paste(text_img.rotate(22, expand=True), (94, 108), alpha=True)
|
| 32 |
+
return frame.save_jpg()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
add_meme(
|
| 36 |
+
"coupon",
|
| 37 |
+
coupon,
|
| 38 |
+
min_images=1,
|
| 39 |
+
max_images=1,
|
| 40 |
+
min_texts=0,
|
| 41 |
+
max_texts=1,
|
| 42 |
+
keywords=["兑换券"],
|
| 43 |
+
date_created=datetime(2022, 3, 12),
|
| 44 |
+
date_modified=datetime(2023, 2, 14),
|
| 45 |
+
)
|
memes/coupon/images/0.png
ADDED
|
Git LFS Details
|
memes/cover_face/__init__.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
from pil_utils import BuildImage
|
| 5 |
+
|
| 6 |
+
from meme_generator import add_meme
|
| 7 |
+
|
| 8 |
+
img_dir = Path(__file__).parent / "images"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def cover_face(images: list[BuildImage], texts, args):
|
| 12 |
+
points = ((15, 15), (448, 0), (445, 456), (0, 465))
|
| 13 |
+
img = images[0].convert("RGBA").square().resize((450, 450)).perspective(points)
|
| 14 |
+
frame = BuildImage.open(img_dir / "0.png")
|
| 15 |
+
frame.paste(img, (120, 150), below=True)
|
| 16 |
+
return frame.save_jpg()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
add_meme(
|
| 20 |
+
"cover_face",
|
| 21 |
+
cover_face,
|
| 22 |
+
min_images=1,
|
| 23 |
+
max_images=1,
|
| 24 |
+
keywords=["捂脸"],
|
| 25 |
+
date_created=datetime(2022, 3, 30),
|
| 26 |
+
date_modified=datetime(2023, 2, 14),
|
| 27 |
+
)
|
memes/cover_face/images/0.png
ADDED
|
Git LFS Details
|
memes/crawl/__init__.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import random
|
| 2 |
+
from datetime import datetime
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from pil_utils import BuildImage
|
| 6 |
+
from pydantic import Field
|
| 7 |
+
|
| 8 |
+
from meme_generator import (
|
| 9 |
+
MemeArgsModel,
|
| 10 |
+
MemeArgsType,
|
| 11 |
+
ParserArg,
|
| 12 |
+
ParserOption,
|
| 13 |
+
add_meme,
|
| 14 |
+
)
|
| 15 |
+
from meme_generator.exception import MemeFeedback
|
| 16 |
+
|
| 17 |
+
img_dir = Path(__file__).parent / "images"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
help_text = "图片编号,范围为 1~92"
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class Model(MemeArgsModel):
|
| 24 |
+
number: int = Field(0, description=help_text)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
args_type = MemeArgsType(
|
| 28 |
+
args_model=Model,
|
| 29 |
+
parser_options=[
|
| 30 |
+
ParserOption(
|
| 31 |
+
names=["-n", "--number"],
|
| 32 |
+
args=[ParserArg(name="number", value="int")],
|
| 33 |
+
help_text=help_text,
|
| 34 |
+
),
|
| 35 |
+
],
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def crawl(images: list[BuildImage], texts: list[str], args: Model):
|
| 40 |
+
total_num = 92
|
| 41 |
+
if args.number == 0:
|
| 42 |
+
num = random.randint(1, total_num)
|
| 43 |
+
elif 1 <= args.number <= total_num:
|
| 44 |
+
num = args.number
|
| 45 |
+
else:
|
| 46 |
+
raise MemeFeedback(f"图片编号错误,请选择 1~{total_num}")
|
| 47 |
+
|
| 48 |
+
img = images[0].convert("RGBA").circle().resize((100, 100))
|
| 49 |
+
frame = BuildImage.open(img_dir / f"{num:02d}.jpg")
|
| 50 |
+
frame.paste(img, (0, 400), alpha=True)
|
| 51 |
+
return frame.save_jpg()
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
add_meme(
|
| 55 |
+
"crawl",
|
| 56 |
+
crawl,
|
| 57 |
+
min_images=1,
|
| 58 |
+
max_images=1,
|
| 59 |
+
args_type=args_type,
|
| 60 |
+
keywords=["爬"],
|
| 61 |
+
date_created=datetime(2021, 5, 5),
|
| 62 |
+
date_modified=datetime(2023, 2, 14),
|
| 63 |
+
)
|
memes/crawl/images/01.jpg
ADDED
|
memes/crawl/images/02.jpg
ADDED
|
Git LFS Details
|
memes/crawl/images/03.jpg
ADDED
|
Git LFS Details
|
memes/crawl/images/04.jpg
ADDED
|
memes/crawl/images/05.jpg
ADDED
|
memes/crawl/images/06.jpg
ADDED
|
memes/crawl/images/07.jpg
ADDED
|
memes/crawl/images/08.jpg
ADDED
|
memes/crawl/images/09.jpg
ADDED
|
memes/crawl/images/10.jpg
ADDED
|
memes/crawl/images/11.jpg
ADDED
|
memes/crawl/images/12.jpg
ADDED
|
memes/crawl/images/13.jpg
ADDED
|
Git LFS Details
|
memes/crawl/images/14.jpg
ADDED
|
memes/crawl/images/15.jpg
ADDED
|
memes/crawl/images/16.jpg
ADDED
|
memes/crawl/images/17.jpg
ADDED
|
memes/crawl/images/18.jpg
ADDED
|
memes/crawl/images/19.jpg
ADDED
|
memes/crawl/images/20.jpg
ADDED
|
memes/crawl/images/21.jpg
ADDED
|
memes/crawl/images/22.jpg
ADDED
|
memes/crawl/images/23.jpg
ADDED
|
memes/crawl/images/24.jpg
ADDED
|
memes/crawl/images/25.jpg
ADDED
|
memes/crawl/images/26.jpg
ADDED
|
memes/crawl/images/27.jpg
ADDED
|