Update memes.py
Browse files
memes.py
CHANGED
|
@@ -10,18 +10,18 @@ IMGFLIP_URL = "https://api.imgflip.com/caption_image"
|
|
| 10 |
|
| 11 |
# 12 template names → Imgflip template_ids
|
| 12 |
TEMPLATE_IDS = {
|
| 13 |
-
"
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
| 18 |
-
"
|
| 19 |
-
"
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
}
|
| 26 |
|
| 27 |
# Initialize OpenAI client
|
|
@@ -56,7 +56,7 @@ def article_to_meme(article_text: str) -> str:
|
|
| 56 |
text1 = match1.group(1).strip()
|
| 57 |
|
| 58 |
# 4) Render meme
|
| 59 |
-
tpl_id = TEMPLATE_IDS.get(template)
|
| 60 |
if not tpl_id:
|
| 61 |
raise KeyError(f"Unknown template: {template}")
|
| 62 |
resp = requests.post(
|
|
|
|
| 10 |
|
| 11 |
# 12 template names → Imgflip template_ids
|
| 12 |
TEMPLATE_IDS = {
|
| 13 |
+
"drake hotline bling": "181913649",
|
| 14 |
+
"uno draw 25 cards": "217743513",
|
| 15 |
+
"bernie asking for support": "222403160",
|
| 16 |
+
"disaster girl": "97984",
|
| 17 |
+
"waiting skeleton": "109765",
|
| 18 |
+
"always has been": "252600902",
|
| 19 |
+
"woman yelling at cat": "188390779",
|
| 20 |
+
"i bet he's thinking about other women": "110163934",
|
| 21 |
+
"one does not simply": "61579",
|
| 22 |
+
"success kid": "61544",
|
| 23 |
+
"oprah you get a": "28251713",
|
| 24 |
+
"hide the pain harold": "27813981",
|
| 25 |
}
|
| 26 |
|
| 27 |
# Initialize OpenAI client
|
|
|
|
| 56 |
text1 = match1.group(1).strip()
|
| 57 |
|
| 58 |
# 4) Render meme
|
| 59 |
+
tpl_id = TEMPLATE_IDS.get(template.lower())
|
| 60 |
if not tpl_id:
|
| 61 |
raise KeyError(f"Unknown template: {template}")
|
| 62 |
resp = requests.post(
|