Mikiko Bazeley
Refactored and removed controlnet
57eccf2
# configuration.py
import os
# ----------------------------------------------
# Default Parameters for Image Generation
# ----------------------------------------------
# ControlNet and Image Generation defaults
default_control_mode = 0
default_guidance_scale = 3.5 # Adjust how strictly the model follows the prompt
default_num_inference_steps = 30 # Number of inference steps for image generation
default_seed = 0 # Seed for randomization (useful for reproducibility)
default_controlnet_conditioning_scale = 0.5 # Influence scale for ControlNet
# ----------------------------------------------
# Font and Color Defaults
# ----------------------------------------------
# Default font sizes and colors for image captions
default_font_size = 40 # Base font size for captions
default_max_font_size = 300 # Maximum allowable font size
default_min_font_size = 10 # Minimum allowable font size
background_color = "#FFFFFF" # Default background color for captions
font_color = "#000000" # Default font color for captions
# ----------------------------------------------
# API URL Configuration
# ----------------------------------------------
# Templates for FLUX and ControlNet API URLs (parameterized to allow flexibility)
flux_model_url_template = "https://api.fireworks.ai/inference/v1/workflows/accounts/fireworks/models/{model_path}/text_to_image"
control_net_url = "https://api.fireworks.ai/inference/v1/workflows/accounts/fireworks/models/flux-1-dev-controlnet-union/control_net"
# ----------------------------------------------
# API Headers Configuration
# ----------------------------------------------
# Function to generate headers for FLUX requests
def get_headers(api_key):
return {
"Authorization": f"Bearer {api_key}", # Bearer token for API authentication
"Content-Type": "application/json", # Requests will send/receive JSON
"Accept": "image/jpeg" # Expect images as the response format
}
# Function to generate headers for ControlNet requests
def get_control_net_headers(api_key):
return {
"accept": "image/jpeg", # Expecting an image in response
"authorization": f"Bearer {api_key}", # API Key for authentication
}
# ----------------------------------------------
# Fonts Configuration
# ----------------------------------------------
# Get the base directory dynamically (root project directory)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Define the fonts you want to allow, with paths relative to BASE_DIR
fonts = {
"DejaVu Sans Bold": os.path.join(BASE_DIR, "fonts", "dejavu-sans-bold.ttf"),
"Covered By You": os.path.join(BASE_DIR, "fonts", "CoveredByYourGrace-Regular.ttf"),
"Julee Regular": os.path.join(BASE_DIR, "fonts", "Julee-Regular.ttf"),
"Kalam Regular": os.path.join(BASE_DIR, "fonts", "Kalam-Regular.ttf"),
"Knewave Regular": os.path.join(BASE_DIR, "fonts", "Knewave-Regular.ttf"),
"Sancreek Regular": os.path.join(BASE_DIR, "fonts", "Sancreek-Regular.ttf"),
"Vast Shadow Regular": os.path.join(BASE_DIR, "fonts", "VastShadow-Regular.ttf")
}
# ----------------------------------------------
# Aspect Ratios Configuration
# ----------------------------------------------
# Dictionary of valid aspect ratios for generated images
valid_aspect_ratios = {
(1, 1): "1:1", # Square
(21, 9): "21:9", # Widescreen
(16, 9): "16:9", # Standard video
(3, 2): "3:2", # Common photo ratio
(5, 4): "5:4", # Almost square
(4, 5): "4:5", # Portrait
(2, 3): "2:3", # Another portrait ratio
(9, 16): "9:16" # Vertical video
}
# ----------------------------------------------
# Holiday-Themed Prompts
# ----------------------------------------------
# List of holiday scene prompts for generating themed images
holiday_scene_prompts = [
"A peaceful winter landscape covered in fresh snow, with delicate snowflakes drifting through the air and soft, frosty patterns along the edges, creating a serene holiday card",
"A cozy Christmas scene featuring a warmly lit cabin in the woods, surrounded by snow-covered trees and twinkling holiday lights, with a sky glowing softly in the background",
"A fireplace with stockings, garlands, and a glowing hearth, set in a cozy room decorated for the holidays, capturing the warmth and tranquility of the season",
"A colorful Hanukkah celebration with glowing menorahs, dreidels, and shimmering holiday lights illuminating the night, set against a rich, deep blue backdrop for a festive scene",
"A vibrant New Year's Eve cityscape with bright fireworks exploding in the sky, colorful confetti drifting through the air, and stars twinkling above the skyline, radiating excitement",
"A mystical Samhain forest scene, with pumpkins glowing softly among tall trees, and a full moon casting light over an ancient Celtic stone circle, evoking an air of magic and mystery",
"A lively Día de Muertos altar adorned with colorful calaveras, bright marigold flowers, and glowing candles, set against a traditional Mexican backdrop, celebrating the holiday’s joy",
"A wintery Yule forest scene under a starry sky, with snow-covered pine trees, holly bushes, and traditional Norse winter symbols decorating the landscape, capturing the warmth of the season",
"A bright and vibrant Diwali celebration with glowing diyas lining a courtyard, intricate rangoli patterns on the ground, and colorful fireworks lighting up the night sky",
"A serene Kwanzaa scene featuring a kinara with glowing candles, surrounded by decorations in red, black, and green, set in a peaceful and reflective atmosphere",
"A bountiful Thanksgiving table scene set outdoors, surrounded by autumn leaves, pumpkins, and a golden sunset, capturing the essence of gratitude and togetherness",
"A tranquil Winter Solstice night with a glowing full moon above, bare trees, stars twinkling in the sky, and a peaceful blanket of snow covering the quiet landscape",
"A festive St. Patrick's Day scene featuring a green countryside, with shamrocks covering the rolling hills, a rainbow stretching across the sky, and a pot of gold in the distance",
"A colorful Lunar New Year street scene with red lanterns hanging from the rooftops, dragon dancers parading down the street, and vibrant fireworks lighting up the night",
"A peaceful Easter garden filled with blooming spring flowers, pastel-colored eggs hidden among the grass, and soft sunlight streaming through the trees",
"A romantic Valentine's Day scene with glowing candles, heart-shaped decorations hanging from tree branches, and a soft pink and red sunset in the sky",
"A lively Holi celebration in an open field, with bursts of vibrant color powder filling the air, and people joyfully celebrating under a bright blue sky",
"A tranquil Ramadan evening scene with a crescent moon and stars hanging in the night sky, glowing lanterns decorating the streets, and peaceful reflections along a quiet river",
"A lively Independence Day celebration with colorful fireworks lighting up the night sky, flags waving in the breeze, and a peaceful lakeside reflecting the celebration"
]
# List of holiday scene prompts for generating themed images
holiday_portrait_prompts = [
"A portrait of a person framed by festive snowflakes and winter patterns, with soft, frosty details along the edges for a holiday card",
"A joyful portrait with Christmas ornaments and twinkling lights decorating the borders, framing the person in a warm, festive glow",
"A cozy portrait with a fireplace scene, stockings, and garlands along the edges, enhancing the warmth of the person in the center",
"A colorful Hanukkah-themed portrait with menorahs, dreidels, and holiday lights framing the person against a rich backdrop",
"A New Year's Eve portrait with celebratory fireworks, stars, and confetti surrounding the person, giving an energetic, celebratory vibe",
"A mystical portrait framed by Samhain symbols like Celtic knots, pumpkins, and candles, creating an enchanting October atmosphere",
"A vibrant Día de Muertos portrait with colorful skulls (calaveras), marigold flowers, and candles framing the subject with traditional flair",
"A Yule-themed portrait framed by holly, pine trees, and Norse winter symbols under a starry sky, bringing out the warmth of the subject",
"A bright and joyful Diwali portrait with lamps (diyas), intricate rangoli patterns, and lotus flowers framing the person for a festive look",
"A cozy winter portrait with Dongzhi Festival glutinous rice balls and family gathering symbols along the edges, giving a homely, warm feeling",
"A spiritual portrait framed by Zuni and Hopi winter motifs, including Soyal dancers and sun symbols, welcoming the return of the sun",
"A winter solstice portrait with bare trees, stars, and the moon softly framing the person in a serene, cold night atmosphere",
"A spooky Halloween-themed portrait framed by pumpkins, bats, ghosts, and cobwebs, adding a playful, haunting edge to the subject",
"A harvest-themed portrait surrounded by pumpkins, cornucopias, autumn leaves, and turkeys, capturing the essence of Thanksgiving",
"A joyful Christmas portrait framed by ornaments, wreaths, and glowing lights, creating a festive and heartwarming holiday look"
]
# List of prompts for holiday cards
holiday_border_prompts = [
"A holiday card with a blank center, surrounded by a delicate border of falling snowflakes and frosty winter patterns along the edges, creating a peaceful winter scene",
"A cozy holiday card with a blank center, bordered by snow-covered pine trees, glowing cabin lights, and twinkling Christmas decorations framing the edges",
"A Lunar New Year holiday card with a blank center, surrounded by red lanterns, dragon dancers, and vibrant fireworks along the edges, celebrating the new year",
"An Easter holiday card with a blank center, bordered by blooming spring flowers, pastel-colored eggs, and soft sunlight, capturing the joy of new beginnings along the edges",
"A Valentine's Day holiday card with a blank center, surrounded by heart-shaped decorations, glowing candles, and pink and red floral patterns for a romantic atmosphere",
"A Holi holiday card with a blank center, framed by bursts of vibrant color powder and festive energy, capturing the lively spirit of the festival along the edges",
"A Ramadan holiday card with a blank center, bordered by a crescent moon, twinkling stars, and glowing lanterns, creating a peaceful and reflective holiday frame",
"An Independence Day holiday card with a blank center, framed by colorful fireworks, waving flags, and festive red, white, and blue decorations along the edges",
"A warm holiday card with a blank center, bordered by stockings, garlands, and a glowing hearth, evoking the coziness of a holiday fireplace",
"A Hanukkah holiday card with a blank center, surrounded by a glowing menorah, dreidels, and shimmering holiday lights along the edges, set against a deep blue background",
"A New Year's Eve holiday card with a blank center, framed by bright fireworks, colorful confetti, and twinkling stars, capturing the festive excitement around the edges",
"A mystical Samhain holiday card with a blank center, bordered by glowing pumpkins, Celtic knots, and a full moon shining through bare trees, creating an air of mystery",
"A Día de Muertos holiday card with a blank center, bordered by vibrant calaveras (skulls), bright marigolds, and glowing candles, celebrating the Mexican holiday along the edges",
"A Yule holiday card with a blank center, bordered by snow-covered pine trees, holly bushes, and traditional Norse winter symbols, creating a festive winter atmosphere",
"A Diwali holiday card with a blank center, framed by glowing diyas, intricate rangoli patterns, and colorful fireworks, lighting up the edges with festive energy",
"A Kwanzaa holiday card with a blank center, surrounded by a kinara with glowing candles and decorations in red, black, and green, creating a reflective and peaceful frame",
"A Thanksgiving holiday card with a blank center, bordered by autumn leaves, pumpkins, and a golden sunset, evoking the warmth and gratitude of the harvest season",
"A Winter Solstice holiday card with a blank center, framed by a glowing full moon, twinkling stars, and bare trees dusted with snow, creating a tranquil winter scene",
"A St. Patrick's Day holiday card with a blank center, bordered by shamrocks, a rainbow, and a pot of gold, framed by lush green fields for a festive Irish celebration",
]
# ----------------------------------------------
# Example Holiday Messages
# ----------------------------------------------
# List of example holiday messages to pair with the scene prompts
example_holiday_messages = [
"Wishing you peace and serenity this winter season. May the snow bring you joy and tranquility!",
"May your Christmas be as cozy and warm as a cabin in the woods, filled with holiday lights and love.",
"Warm wishes for the holidays! May your hearth and home be filled with love and joy this season.",
"Happy Hanukkah! May the light of the menorah shine brightly and bring joy to your heart.",
"Wishing you a vibrant New Year's Eve filled with excitement, fireworks, and joy for the year ahead!",
"May the magic and mystery of Samhain fill your spirit with wonder. Have a mystical holiday!",
"Celebrating the joy of Día de Muertos! May the memories of your loved ones bring peace and happiness.",
"Wishing you a Yule season filled with the warmth of the Norse tradition and the beauty of snowy forests.",
"Happy Diwali! May the lights of the diyas and the colors of rangoli bring you prosperity and joy.",
"Wishing you a reflective and peaceful Kwanzaa. May your home be filled with love, light, and unity.",
"Happy Thanksgiving! May your table be filled with gratitude, and your heart with the warmth of togetherness.",
"Wishing you a peaceful Winter Solstice night under the full moon. May the season bring you reflection and rest.",
"May the luck of the Irish be with you! Wishing you a joyful St. Patrick's Day filled with rainbows and gold.",
"Happy Lunar New Year! May the dragon dancers bring joy, and the fireworks light up a prosperous new year.",
"Wishing you a peaceful Easter surrounded by blooming flowers and the warmth of springtime sunshine.",
"Happy Valentine's Day! May your day be filled with love, glowing candles, and heartwarming moments.",
"Wishing you a joyful Holi! May the colors of the festival fill your life with vibrancy and happiness.",
"Ramadan Mubarak! May the crescent moon bring you peace, and the lanterns light up your spiritual path.",
"Happy Independence Day! May the fireworks light up the sky, and may freedom continue to inspire us all."
]