from PIL import Image beard_styles = { "Old Clonmel": "beard1.png", "The Beehive": "beard2.png", "Waxed Wings": "beard3.png" } def generate_bee_beard(image, style, prompt_strength=0.75): if image is None: return None # --- Step 1: Load beard PNG --- beard_path = beard_styles[style] beard = Image.open(beard_path).convert("RGBA") user_img = image.convert("RGBA") # Resize beard to fit face roughly beard = beard.resize((user_img.width, int(user_img.height/2))) user_img.paste(beard, (0, int(user_img.height/2)), beard) # --- Step 2: AI (optional inpainting if you enabled it) --- # If you’re running the Stable Diffusion inpainting pipeline: # result = pipe(...).images[0] # Otherwise, just use the pasted version for now: result = user_img # --- Step 3: Add Frame --- frame = Image.open("frame.png").convert("RGBA") frame = frame.resize(result.size) # match sizes final = result.copy() final.paste(frame, (0,0), frame) return final