Spaces:
Runtime error
Runtime error
Create config.py
Browse files
config.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
"""
|
| 3 |
+
Configuration settings for the Text-to-Infographics Generator
|
| 4 |
+
"""
|
| 5 |
+
import os
|
| 6 |
+
from typing import Dict, List, Tuple
|
| 7 |
+
|
| 8 |
+
class Config:
|
| 9 |
+
"""Application configuration"""
|
| 10 |
+
|
| 11 |
+
# API Keys (set in Hugging Face Spaces secrets)
|
| 12 |
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "")
|
| 13 |
+
|
| 14 |
+
# Application settings
|
| 15 |
+
APP_TITLE = "AI Text-to-Infographics Generator"
|
| 16 |
+
APP_DESCRIPTION = "Transform your text into beautiful infographics with AI"
|
| 17 |
+
|
| 18 |
+
# Processing limits
|
| 19 |
+
MAX_TEXT_LENGTH = 15000
|
| 20 |
+
MIN_TEXT_LENGTH = 50
|
| 21 |
+
MAX_SECTIONS = 10
|
| 22 |
+
|
| 23 |
+
# Image settings
|
| 24 |
+
DEFAULT_WIDTH = 1080
|
| 25 |
+
DEFAULT_HEIGHT = 1920
|
| 26 |
+
DPI = 300
|
| 27 |
+
QUALITY = 95
|
| 28 |
+
|
| 29 |
+
# Supported formats
|
| 30 |
+
SUPPORTED_FORMATS = ["PNG", "PDF", "SVG"]
|
| 31 |
+
|
| 32 |
+
# Templates
|
| 33 |
+
TEMPLATES = [
|
| 34 |
+
"Modern",
|
| 35 |
+
"Corporate",
|
| 36 |
+
"Creative",
|
| 37 |
+
"Minimalist",
|
| 38 |
+
"Academic"
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
# Layout options
|
| 42 |
+
LAYOUTS = [
|
| 43 |
+
"Vertical",
|
| 44 |
+
"Horizontal",
|
| 45 |
+
"Grid",
|
| 46 |
+
"Flow"
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
# Color palettes
|
| 50 |
+
COLOR_PALETTES = {
|
| 51 |
+
"Blue": "#3498db",
|
| 52 |
+
"Green": "#2ecc71",
|
| 53 |
+
"Purple": "#9b59b6",
|
| 54 |
+
"Orange": "#e67e22",
|
| 55 |
+
"Red": "#e74c3c",
|
| 56 |
+
"Teal": "#1abc9c",
|
| 57 |
+
"Dark": "#2c3e50",
|
| 58 |
+
"Pink": "#fd79a8"
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# Font settings
|
| 62 |
+
DEFAULT_FONTS = {
|
| 63 |
+
"title": ("Arial", 24, "bold"),
|
| 64 |
+
"heading": ("Arial", 18, "bold"),
|
| 65 |
+
"body": ("Arial", 14, "normal"),
|
| 66 |
+
"caption": ("Arial", 12, "normal")
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
# Gemini settings
|
| 70 |
+
GEMINI_MODEL = "gemini-1.5-flash"
|
| 71 |
+
GEMINI_TEMPERATURE = 0.3
|
| 72 |
+
GEMINI_MAX_TOKENS = 2048
|
| 73 |
+
|
| 74 |
+
# Color schemes for different templates
|
| 75 |
+
TEMPLATE_COLORS = {
|
| 76 |
+
"Modern": {
|
| 77 |
+
"primary": "#3498db",
|
| 78 |
+
"secondary": "#2ecc71",
|
| 79 |
+
"accent": "#f39c12",
|
| 80 |
+
"background": "#ecf0f1",
|
| 81 |
+
"text": "#2c3e50"
|
| 82 |
+
},
|
| 83 |
+
"Corporate": {
|
| 84 |
+
"primary": "#2c3e50",
|
| 85 |
+
"secondary": "#34495e",
|
| 86 |
+
"accent": "#3498db",
|
| 87 |
+
"background": "#ffffff",
|
| 88 |
+
"text": "#2c3e50"
|
| 89 |
+
},
|
| 90 |
+
"Creative": {
|
| 91 |
+
"primary": "#9b59b6",
|
| 92 |
+
"secondary": "#e91e63",
|
| 93 |
+
"accent": "#f39c12",
|
| 94 |
+
"background": "#fdf2e9",
|
| 95 |
+
"text": "#2c3e50"
|
| 96 |
+
},
|
| 97 |
+
"Minimalist": {
|
| 98 |
+
"primary": "#2c3e50",
|
| 99 |
+
"secondary": "#95a5a6",
|
| 100 |
+
"accent": "#3498db",
|
| 101 |
+
"background": "#ffffff",
|
| 102 |
+
"text": "#2c3e50"
|
| 103 |
+
},
|
| 104 |
+
"Academic": {
|
| 105 |
+
"primary": "#34495e",
|
| 106 |
+
"secondary": "#7f8c8d",
|
| 107 |
+
"accent": "#2980b9",
|
| 108 |
+
"background": "#f8f9fa",
|
| 109 |
+
"text": "#2c3e50"
|
| 110 |
+
}
|
| 111 |
+
}
|