Spaces:
Sleeping
Sleeping
| """Config for Doodle Duel — draw against the clock, the AI tries to guess it. | |
| The word bank is built from per-category word lists (CATWORDS). Most words just | |
| need themselves as the accepted answer — the letter-count/pattern hint forces the | |
| model to the exact form. SYN holds synonym overrides for the few words (mostly | |
| proper nouns) where multiple forms should count. | |
| """ | |
| import os | |
| MODEL_BASE_URL = os.environ.get("MODEL_BASE_URL", "").rstrip("/") | |
| MODEL_NAME = os.environ.get("MODEL_NAME", "auto") # 'auto' → detect from /v1/models | |
| MODEL_API_KEY = os.environ.get("MODEL_API_KEY", "") | |
| REQUEST_TIMEOUT = int(os.environ.get("REQUEST_TIMEOUT", "210")) | |
| MOCK_MODE = os.environ.get("MOCK_MODE", "").lower() in {"1", "true", "yes"} or not MODEL_BASE_URL | |
| ROUND_SECONDS = int(os.environ.get("ROUND_SECONDS", "120")) | |
| GUESS_MIN_INTERVAL = float(os.environ.get("GUESS_MIN_INTERVAL", "4.0")) | |
| POLL_INTERVAL = float(os.environ.get("POLL_INTERVAL", "5.0")) # bg guess cadence | |
| WORD_CHOICES = 3 | |
| CANVAS_W, CANVAS_H = 560, 360 | |
| BRUSH_SIZE = int(os.environ.get("BRUSH_SIZE", "4")) | |
| MAX_HINTS = 3 | |
| DEFAULT_EMOJI = { | |
| "animal": "🐾", "food": "🍽️", "object": "📦", "household": "🏠", "tool": "🛠️", | |
| "nature": "🌿", "space": "🪐", "vehicle": "🚗", "building": "🏛️", "clothing": "👕", | |
| "body": "🧍", "sport": "🏅", "music": "🎵", "fantasy": "🐉", "job": "💼", | |
| "brand": "🏷️", "character": "🎭", "famous": "⭐", | |
| } | |
| # Synonym overrides — only where more than one form should win. | |
| SYN = { | |
| "donut": ["donut", "doughnut"], "doughnut": ["doughnut", "donut"], | |
| "sofa": ["sofa", "couch"], "airplane": ["airplane", "plane", "aeroplane"], | |
| "bicycle": ["bicycle", "bike"], "soccer ball": ["soccer ball", "football"], | |
| "ice cream": ["ice cream", "icecream"], "french fries": ["french fries", "fries"], | |
| "light bulb": ["light bulb", "lightbulb"], "flashlight": ["flashlight", "torch"], | |
| "trousers": ["trousers", "pants"], "pants": ["pants", "trousers"], | |
| "spider-man": ["spiderman", "spider man", "spider-man"], | |
| "apple logo": ["apple", "apple logo"], "mcdonalds": ["mcdonalds", "mcdonald's", "mcdonald"], | |
| "coca cola": ["coca cola", "coke", "cocacola"], "tiktok": ["tiktok", "tik tok"], | |
| "ronaldo": ["ronaldo", "cristiano ronaldo", "cristiano", "cr7"], | |
| "messi": ["messi", "lionel messi", "leo messi"], | |
| "einstein": ["einstein", "albert einstein"], "newton": ["newton", "isaac newton"], | |
| "nikola tesla": ["nikola tesla", "tesla"], "charles darwin": ["charles darwin", "darwin"], | |
| "stephen hawking": ["stephen hawking", "hawking"], "elon musk": ["elon musk", "elon", "musk"], | |
| "abraham lincoln": ["abraham lincoln", "lincoln"], "barack obama": ["barack obama", "obama"], | |
| "nelson mandela": ["nelson mandela", "mandela"], "martin luther king": ["martin luther king", "mlk"], | |
| "mahatma gandhi": ["mahatma gandhi", "gandhi"], "queen elizabeth": ["queen elizabeth", "queen elizabeth ii"], | |
| "van gogh": ["van gogh", "vincent van gogh"], "picasso": ["picasso", "pablo picasso"], | |
| "leonardo da vinci": ["leonardo da vinci", "da vinci"], "shakespeare": ["shakespeare", "william shakespeare"], | |
| "michael jordan": ["michael jordan", "jordan"], "lebron james": ["lebron james", "lebron"], | |
| "kobe bryant": ["kobe bryant", "kobe"], "muhammad ali": ["muhammad ali", "ali"], | |
| "freddie mercury": ["freddie mercury", "freddie"], "bob marley": ["bob marley", "marley"], | |
| "mr bean": ["mr bean", "rowan atkinson"], "mbappe": ["mbappe", "kylian mbappe"], | |
| "maradona": ["maradona", "diego maradona"], "beckham": ["beckham", "david beckham"], | |
| "zidane": ["zidane", "zinedine zidane"], "mickey mouse": ["mickey mouse", "mickey"], | |
| "darth vader": ["darth vader", "vader"], "santa claus": ["santa", "santa claus", "father christmas"], | |
| "sachin tendulkar": ["sachin tendulkar", "sachin", "tendulkar"], | |
| "virat kohli": ["virat kohli", "kohli", "virat"], "the beatles": ["the beatles", "beatles"], | |
| "michael jackson": ["michael jackson"], "taylor swift": ["taylor swift"], | |
| } | |
| CATWORDS = { | |
| "animal": [ | |
| "cat", "dog", "elephant", "giraffe", "lion", "tiger", "bear", "panda", "koala", | |
| "kangaroo", "monkey", "gorilla", "zebra", "horse", "donkey", "cow", "bull", "pig", | |
| "sheep", "goat", "deer", "moose", "rabbit", "squirrel", "hedgehog", "mouse", "rat", | |
| "hamster", "fox", "wolf", "raccoon", "skunk", "beaver", "otter", "badger", "mole", | |
| "bat", "frog", "toad", "snake", "lizard", "gecko", "chameleon", "iguana", "crocodile", | |
| "alligator", "turtle", "tortoise", "dinosaur", "snail", "slug", "worm", "ant", "bee", | |
| "wasp", "butterfly", "moth", "caterpillar", "ladybug", "spider", "scorpion", | |
| "grasshopper", "cricket", "dragonfly", "beetle", "fly", "mosquito", "cockroach", | |
| "centipede", "octopus", "squid", "jellyfish", "crab", "lobster", "shrimp", "starfish", | |
| "seahorse", "shark", "whale", "dolphin", "fish", "clownfish", "pufferfish", "eel", | |
| "stingray", "penguin", "owl", "eagle", "hawk", "falcon", "parrot", "peacock", | |
| "flamingo", "ostrich", "swan", "duck", "goose", "chicken", "rooster", "turkey", | |
| "pigeon", "crow", "sparrow", "robin", "woodpecker", "hummingbird", "seagull", | |
| "pelican", "toucan", "camel", "llama", "alpaca", "rhino", "hippo", "buffalo", "bison", | |
| "sloth", "armadillo", "anteater", "platypus", "polar bear", "walrus", "seal", | |
| "narwhal", "ram", "piglet", "puppy", "kitten", "chick", "tadpole", | |
| "jaguar", "leopard", "cheetah", "panther", "hyena", "meerkat", "ferret", | |
| "chipmunk", "porcupine", "wombat", "orangutan", "chimpanzee", "baboon", | |
| "lemur", "vulture", "raven", "canary", "macaw", "puffin", "heron", "emu", | |
| "cobra", "python", "rattlesnake", "anaconda", "salamander", "axolotl", | |
| "swordfish", "piranha", "goldfish", "clam", "oyster", "sea urchin", | |
| "hermit crab", "praying mantis", "firefly", "earthworm", "silkworm", | |
| ], | |
| "food": [ | |
| "pizza", "hamburger", "hotdog", "sandwich", "taco", "burrito", "sushi", "ramen", | |
| "noodles", "spaghetti", "lasagna", "french fries", "popcorn", "pretzel", "donut", | |
| "bagel", "croissant", "pancake", "waffle", "toast", "bread", "baguette", "cupcake", | |
| "muffin", "cake", "birthday cake", "pie", "cookie", "brownie", "candy", "lollipop", | |
| "chocolate", "ice cream", "popsicle", "marshmallow", "honey", "jam", "butter", | |
| "cheese", "egg", "fried egg", "bacon", "sausage", "steak", "meatball", "soup", | |
| "salad", "apple", "banana", "orange", "lemon", "lime", "grapes", "strawberry", | |
| "blueberry", "cherry", "peach", "pear", "pineapple", "watermelon", "mango", "kiwi", | |
| "coconut", "avocado", "tomato", "potato", "carrot", "corn", "broccoli", "mushroom", | |
| "onion", "garlic", "pepper", "chili", "cucumber", "lettuce", "pumpkin", "eggplant", | |
| "peas", "peanut", "acorn", "coffee", "tea", "milk", "juice", "soda", "wine", "beer", | |
| "milkshake", "smoothie", "cotton candy", "candy cane", "nachos", "cereal", "yogurt", | |
| "pudding", "cracker", "kebab", "dumpling", "ice cream cone", "gingerbread man", | |
| "quesadilla", "omelette", "churros", "cheesecake", "chewing gum", | |
| "fortune cookie", "spring roll", "french toast", "garlic bread", | |
| "onion rings", "gummy bear", "jellybean", "macaron", "corn dog", "cookie jar", | |
| ], | |
| "object": [ | |
| "clock", "alarm clock", "watch", "hourglass", "calendar", "lamp", "light bulb", | |
| "candle", "lantern", "flashlight", "mirror", "picture frame", "vase", "umbrella", | |
| "key", "lock", "padlock", "chain", "rope", "ladder", "box", "bag", "backpack", | |
| "suitcase", "briefcase", "wallet", "basket", "bucket", "balloon", "kite", "yo-yo", | |
| "dice", "playing cards", "magnet", "spring", "gear", "wheel", "anchor", "bell", | |
| "whistle", "trophy", "medal", "crown", "ring", "necklace", "bracelet", "magnifying glass", | |
| "telescope", "microscope", "binoculars", "camera", "television", "radio", "speaker", | |
| "headphones", "microphone", "telephone", "smartphone", "laptop", "computer", "keyboard", | |
| "monitor", "printer", "battery", "plug", "remote control", "game controller", "joystick", | |
| "book", "newspaper", "envelope", "stamp", "map", "globe", "pencil", "pen", "marker", | |
| "crayon", "paintbrush", "ruler", "compass", "calculator", "notebook", "scissors", | |
| "stapler", "tape", "glue", "eraser", "clipboard", "gift", "ribbon", "flag", "banner", | |
| "fireworks", "sparkler", "lighter", "matchstick", "fan", "thermometer", "scale", | |
| "syringe", "bandage", "pill", "first aid kit", "wheelchair", "crutch", "glasses", | |
| "sunglasses", "wristwatch", "earring", "tie", "toolbox", "fishing rod", "net", | |
| "shopping cart", "traffic cone", "trash can", "mailbox", "fire hydrant", "street lamp", | |
| "abacus", "snow globe", "piggy bank", "dreamcatcher", "wind chime", "scarecrow", | |
| "sundial", "chandelier", "disco ball", "lava lamp", "periscope", "stethoscope", | |
| "kaleidoscope", "hot air balloon", "treasure map", "scroll", "quill", "abacus", | |
| ], | |
| "household": [ | |
| "chair", "table", "desk", "sofa", "bed", "bench", "stool", "bookshelf", "wardrobe", | |
| "cabinet", "drawer", "rug", "curtain", "blanket", "pillow", "towel", "soap", | |
| "toothbrush", "toothpaste", "comb", "hairbrush", "razor", "bathtub", "shower", "sink", | |
| "toilet", "faucet", "mop", "broom", "dustpan", "vacuum", "plate", "bowl", "cup", "mug", | |
| "glass", "teapot", "kettle", "pot", "frying pan", "spatula", "whisk", "rolling pin", | |
| "ladle", "cutting board", "grater", "blender", "toaster", "microwave", "oven", "stove", | |
| "refrigerator", "washing machine", "iron", "sewing machine", "needle", "thread", | |
| "button", "zipper", "candlestick", "doormat", "clothes hanger", "laundry basket", | |
| ], | |
| "tool": [ | |
| "hammer", "screwdriver", "wrench", "pliers", "saw", "drill", "nail", "screw", "bolt", | |
| "nut", "axe", "shovel", "rake", "hoe", "pickaxe", "knife", "fork", "spoon", "scythe", | |
| "chisel", "file", "level", "tape measure", "paint roller", "wheelbarrow", "watering can", | |
| "lawn mower", "chainsaw", | |
| ], | |
| "nature": [ | |
| "tree", "palm tree", "pine tree", "cactus", "bush", "flower", "rose", "tulip", | |
| "sunflower", "daisy", "lily", "dandelion", "leaf", "maple leaf", "clover", "grass", | |
| "acorn", "pinecone", "seed", "sprout", "vine", "fern", "bamboo", "seaweed", "coral", | |
| "log", "branch", "root", "tree stump", "mountain", "hill", "volcano", "cliff", "cave", | |
| "valley", "desert", "island", "beach", "ocean", "lake", "river", "waterfall", "pond", | |
| "wave", "iceberg", "glacier", "cloud", "rainbow", "lightning", "rain", "raindrop", | |
| "snow", "snowflake", "snowman", "icicle", "tornado", "hurricane", "fog", "fire", | |
| "flame", "smoke", "rock", "boulder", "crystal", "diamond", "fossil", "mushroom cloud", | |
| "puddle", "campfire", "sandcastle", | |
| ], | |
| "space": [ | |
| "sun", "moon", "star", "planet", "earth", "saturn", "mars", "jupiter", "rocket", | |
| "astronaut", "alien", "ufo", "satellite", "space station", "comet", "asteroid", | |
| "meteor", "galaxy", "black hole", "constellation", "shooting star", "flying saucer", | |
| "crescent moon", "solar system", | |
| ], | |
| "vehicle": [ | |
| "car", "truck", "bus", "school bus", "van", "taxi", "jeep", "race car", "fire truck", | |
| "ambulance", "police car", "tractor", "bulldozer", "crane", "forklift", "dump truck", | |
| "tow truck", "garbage truck", "motorcycle", "scooter", "tricycle", "unicycle", | |
| "skateboard", "roller skates", "train", "tram", "subway", "airplane", "jet", | |
| "helicopter", "hot air balloon", "blimp", "glider", "parachute", "boat", "sailboat", | |
| "canoe", "kayak", "ship", "submarine", "yacht", "ferry", "jet ski", "surfboard", | |
| "rowboat", "bicycle", | |
| ], | |
| "building": [ | |
| "house", "hut", "cottage", "castle", "palace", "tower", "skyscraper", "cabin", "tent", | |
| "igloo", "lighthouse", "windmill", "barn", "church", "mosque", "temple", "pyramid", | |
| "sphinx", "statue of liberty", "eiffel tower", "big ben", "taj mahal", "great wall", | |
| "stonehenge", "bridge", "dam", "fountain", "well", "fence", "gate", "door", "window", | |
| "stairs", "elevator", "chimney", "treehouse", "birdhouse", "doghouse", "tunnel", | |
| "ferris wheel", "roller coaster", "swing", "slide", "seesaw", "playground", "tower bridge", | |
| ], | |
| "clothing": [ | |
| "shirt", "t-shirt", "trousers", "jeans", "shorts", "skirt", "dress", "suit", "tie", | |
| "bow tie", "jacket", "coat", "hoodie", "sweater", "vest", "scarf", "gloves", "mittens", | |
| "hat", "cap", "top hat", "beanie", "helmet", "socks", "shoes", "boots", "sneakers", | |
| "sandals", "slippers", "high heels", "flip flops", "belt", "suspenders", "apron", | |
| "swimsuit", "pajamas", "raincoat", "poncho", "kimono", "robe", "crown", "backpack", | |
| "handbag", "purse", "diaper", "bib", "tuxedo", | |
| ], | |
| "body": [ | |
| "eye", "ear", "nose", "mouth", "lips", "tongue", "tooth", "hand", "finger", "thumb", | |
| "foot", "leg", "arm", "elbow", "knee", "head", "brain", "heart", "lungs", "bone", | |
| "skull", "skeleton", "fingerprint", "eyebrow", "mustache", "beard", "footprint", | |
| "rib cage", "muscle", "hair", | |
| ], | |
| "sport": [ | |
| "soccer ball", "basketball", "baseball", "baseball bat", "tennis ball", "tennis racket", | |
| "golf club", "bowling ball", "bowling pin", "volleyball", "hockey stick", "hockey puck", | |
| "ice skate", "ski", "snowboard", "sled", "boxing glove", "dumbbell", "barbell", | |
| "jump rope", "dartboard", "dart", "fishing rod", "frisbee", "bow and arrow", "target", | |
| "whistle", "goal post", "skateboard ramp", "trophy", | |
| ], | |
| "music": [ | |
| "guitar", "electric guitar", "piano", "violin", "cello", "harp", "drum", "drum set", | |
| "trumpet", "trombone", "saxophone", "flute", "clarinet", "tuba", "harmonica", | |
| "accordion", "banjo", "ukulele", "xylophone", "tambourine", "maracas", "triangle", | |
| "cymbals", "bagpipes", "music note", "treble clef", "gramophone", "metronome", | |
| ], | |
| "fantasy": [ | |
| "dragon", "unicorn", "mermaid", "fairy", "elf", "dwarf", "wizard", "witch", "vampire", | |
| "werewolf", "zombie", "ghost", "mummy", "frankenstein", "monster", "ogre", "troll", | |
| "goblin", "genie", "knight", "king", "queen", "princess", "prince", "pirate", "ninja", | |
| "samurai", "viking", "robot", "cyclops", "phoenix", "griffin", "centaur", "magic wand", | |
| "magic lamp", "crystal ball", "potion", "treasure chest", "gravestone", "haunted house", | |
| ], | |
| "job": [ | |
| "doctor", "nurse", "chef", "police officer", "firefighter", "teacher", "scientist", | |
| "astronaut", "pilot", "sailor", "farmer", "painter", "clown", "magician", "cowboy", | |
| "detective", "soldier", "judge", "mailman", "plumber", "mechanic", "barber", "waiter", | |
| "lifeguard", "referee", "ballerina", "superhero", "construction worker", "fisherman", | |
| "santa claus", | |
| ], | |
| "brand": [ | |
| "youtube", "spotify", "netflix", "instagram", "tiktok", "whatsapp", "mcdonalds", "nike", | |
| "coca cola", "amazon", "android", "playstation", "starbucks", "twitter", "google", | |
| "apple logo", "facebook", "snapchat", "pepsi", "adidas", "burger king", "kfc", "lego", | |
| "wifi", "bluetooth", | |
| ], | |
| "character": [ | |
| "mario", "luigi", "pikachu", "mickey mouse", "batman", "spider-man", "superman", | |
| "minion", "spongebob", "hello kitty", "darth vader", "pokeball", "harry potter", | |
| "yoda", "iron man", "captain america", "hulk", "elsa", "shrek", "pac-man", "sonic", | |
| "homer simpson", "scooby doo", "winnie the pooh", "olaf", "buzz lightyear", "woody", | |
| "kirby", "angry bird", "among us", "stormtrooper", "joker", "wonder woman", | |
| ], | |
| "famous": [ | |
| "ronaldo", "messi", "neymar", "mbappe", "maradona", "pele", "beckham", "zidane", | |
| "ronaldinho", "salah", "haaland", "michael jordan", "lebron james", "kobe bryant", | |
| "serena williams", "roger federer", "nadal", "djokovic", "muhammad ali", "tiger woods", | |
| "usain bolt", "sachin tendulkar", "virat kohli", "lewis hamilton", | |
| "einstein", "newton", "nikola tesla", "charles darwin", "stephen hawking", "marie curie", | |
| "galileo", "edison", "steve jobs", "elon musk", "bill gates", "mark zuckerberg", | |
| "michael jackson", "elvis", "beethoven", "mozart", "beyonce", "taylor swift", "eminem", | |
| "freddie mercury", "bob marley", "lady gaga", "adele", "drake", "snoop dogg", "rihanna", | |
| "the beatles", "ed sheeran", "billie eilish", | |
| "gandhi", "abraham lincoln", "napoleon", "queen elizabeth", "nelson mandela", | |
| "martin luther king", "barack obama", "shakespeare", "cleopatra", "julius caesar", | |
| "mother teresa", "joan of arc", | |
| "van gogh", "picasso", "leonardo da vinci", "michelangelo", "salvador dali", "frida kahlo", | |
| "mona lisa", "charlie chaplin", "mr bean", "bruce lee", "jackie chan", "marilyn monroe", | |
| "leonardo dicaprio", "will smith", | |
| ], | |
| } | |
| # Easy = physical everyday things you can clearly draw | |
| # Hard = brands, famous people, fictional characters, landmarks | |
| _EASY_CATS = {"animal", "food", "nature", "vehicle", "household", "clothing", | |
| "body", "sport", "space", "tool", "object", "music"} | |
| _HARD_CATS = {"brand", "famous", "character", "building", "fantasy", "job"} | |
| def _build_words(): | |
| words = {} | |
| for cat, lst in CATWORDS.items(): | |
| emoji = DEFAULT_EMOJI.get(cat, "✏️") | |
| difficulty = "easy" if cat in _EASY_CATS else "hard" | |
| for w in lst: | |
| if w in words: | |
| continue # keep first category, skip dupes | |
| words[w] = (emoji, cat, SYN.get(w, [w]), difficulty) | |
| return words | |
| WORDS = _build_words() | |