Spaces:
Running
on
Zero
Running
on
Zero
Update config.py
Browse files
config.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
"""
|
| 2 |
-
Configuration file for
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
import os
|
|
@@ -9,10 +11,13 @@ from typing import Dict, Any
|
|
| 9 |
|
| 10 |
# Application Configuration
|
| 11 |
APP_CONFIG = {
|
| 12 |
-
"title": "
|
| 13 |
-
"description": "
|
| 14 |
"version": "2.0.0",
|
| 15 |
-
"author": "
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
# BAGEL Model Configuration
|
|
@@ -105,7 +110,7 @@ PROCESSING_CONFIG = {
|
|
| 105 |
"timeout_seconds": 120 # Increased for BAGEL processing
|
| 106 |
}
|
| 107 |
|
| 108 |
-
#
|
| 109 |
FLUX_RULES = {
|
| 110 |
"remove_patterns": [
|
| 111 |
r',\s*trending on artstation',
|
|
@@ -122,33 +127,54 @@ FLUX_RULES = {
|
|
| 122 |
"portrait": ", Shot on Hasselblad X2D 100C, 90mm f/2.5 lens at f/2.8, professional portrait photography",
|
| 123 |
"landscape": ", Shot on Phase One XT, 40mm f/4 lens at f/8, epic landscape photography",
|
| 124 |
"street": ", Shot on Leica M11, 35mm f/1.4 lens at f/2.8, documentary street photography",
|
|
|
|
|
|
|
| 125 |
"default": ", Shot on Phase One XF IQ4, 80mm f/2.8 lens at f/4, professional photography"
|
| 126 |
},
|
| 127 |
|
| 128 |
"lighting_enhancements": {
|
| 129 |
"dramatic": ", dramatic cinematic lighting",
|
| 130 |
"portrait": ", professional studio lighting with subtle rim light",
|
|
|
|
|
|
|
| 131 |
"default": ", masterful natural lighting"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# Scoring Configuration
|
| 136 |
SCORING_CONFIG = {
|
| 137 |
"max_score": 100,
|
| 138 |
"score_weights": {
|
| 139 |
-
"prompt_quality": 0.
|
| 140 |
"technical_details": 0.25,
|
| 141 |
-
"
|
| 142 |
-
"
|
| 143 |
},
|
| 144 |
|
| 145 |
"grade_thresholds": {
|
| 146 |
95: {"grade": "LEGENDARY", "color": "#059669"},
|
| 147 |
90: {"grade": "EXCELLENT", "color": "#10b981"},
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
}
|
| 154 |
|
|
@@ -162,11 +188,84 @@ ENVIRONMENT = {
|
|
| 162 |
"space_author": os.getenv("SPACE_AUTHOR_NAME", "")
|
| 163 |
}
|
| 164 |
|
| 165 |
-
# BAGEL
|
| 166 |
BAGEL_PROMPTS = {
|
| 167 |
-
"
|
| 168 |
-
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
# Flash Attention Installation Command
|
|
@@ -187,5 +286,6 @@ __all__ = [
|
|
| 187 |
"SCORING_CONFIG",
|
| 188 |
"ENVIRONMENT",
|
| 189 |
"BAGEL_PROMPTS",
|
|
|
|
| 190 |
"FLASH_ATTN_INSTALL"
|
| 191 |
]
|
|
|
|
| 1 |
"""
|
| 2 |
+
Configuration file for Phramer AI
|
| 3 |
+
By Pariente AI, for MIA TV Series
|
| 4 |
+
|
| 5 |
+
Multimodal tool with BAGEL integration and professional photographic prompt optimization
|
| 6 |
"""
|
| 7 |
|
| 8 |
import os
|
|
|
|
| 11 |
|
| 12 |
# Application Configuration
|
| 13 |
APP_CONFIG = {
|
| 14 |
+
"title": "Phramer AI",
|
| 15 |
+
"description": "Multimodal tool that reads images and turns them into refined, photo-realistic prompts. Ready for Midjourney, Flux or any generative engine.",
|
| 16 |
"version": "2.0.0",
|
| 17 |
+
"author": "Pariente AI",
|
| 18 |
+
"project": "MIA TV Series",
|
| 19 |
+
"tagline": "By Pariente AI, for MIA TV Series",
|
| 20 |
+
"logline": "Phramer AI is a multimodal tool that reads an image and turns it into a refined, photo-realistic prompt. Ready for Midjourney, Flux or any generative engine."
|
| 21 |
}
|
| 22 |
|
| 23 |
# BAGEL Model Configuration
|
|
|
|
| 110 |
"timeout_seconds": 120 # Increased for BAGEL processing
|
| 111 |
}
|
| 112 |
|
| 113 |
+
# Prompt Optimization Rules for Multi-Engine Compatibility
|
| 114 |
FLUX_RULES = {
|
| 115 |
"remove_patterns": [
|
| 116 |
r',\s*trending on artstation',
|
|
|
|
| 127 |
"portrait": ", Shot on Hasselblad X2D 100C, 90mm f/2.5 lens at f/2.8, professional portrait photography",
|
| 128 |
"landscape": ", Shot on Phase One XT, 40mm f/4 lens at f/8, epic landscape photography",
|
| 129 |
"street": ", Shot on Leica M11, 35mm f/1.4 lens at f/2.8, documentary street photography",
|
| 130 |
+
"cinematic": ", Shot on ARRI Alexa LF, 35mm anamorphic lens, cinematic lighting",
|
| 131 |
+
"architectural": ", Shot on Canon EOS R5, 24-70mm f/2.8 lens at f/8, architectural photography",
|
| 132 |
"default": ", Shot on Phase One XF IQ4, 80mm f/2.8 lens at f/4, professional photography"
|
| 133 |
},
|
| 134 |
|
| 135 |
"lighting_enhancements": {
|
| 136 |
"dramatic": ", dramatic cinematic lighting",
|
| 137 |
"portrait": ", professional studio lighting with subtle rim light",
|
| 138 |
+
"cinematic": ", moody cinematic lighting with practical lights",
|
| 139 |
+
"natural": ", natural lighting with soft shadows",
|
| 140 |
"default": ", masterful natural lighting"
|
| 141 |
+
},
|
| 142 |
+
|
| 143 |
+
"style_enhancements": {
|
| 144 |
+
"photorealistic": ", photorealistic, ultra-detailed",
|
| 145 |
+
"cinematic": ", cinematic composition, film grain",
|
| 146 |
+
"commercial": ", commercial photography style",
|
| 147 |
+
"editorial": ", editorial photography style",
|
| 148 |
+
"fine_art": ", fine art photography"
|
| 149 |
}
|
| 150 |
}
|
| 151 |
|
| 152 |
+
# Enhanced Scoring Configuration with Professional Photography Criteria
|
| 153 |
SCORING_CONFIG = {
|
| 154 |
"max_score": 100,
|
| 155 |
"score_weights": {
|
| 156 |
+
"prompt_quality": 0.25,
|
| 157 |
"technical_details": 0.25,
|
| 158 |
+
"professional_photography": 0.25,
|
| 159 |
+
"multi_engine_optimization": 0.25
|
| 160 |
},
|
| 161 |
|
| 162 |
"grade_thresholds": {
|
| 163 |
95: {"grade": "LEGENDARY", "color": "#059669"},
|
| 164 |
90: {"grade": "EXCELLENT", "color": "#10b981"},
|
| 165 |
+
85: {"grade": "VERY GOOD", "color": "#22c55e"},
|
| 166 |
+
75: {"grade": "GOOD", "color": "#84cc16"},
|
| 167 |
+
65: {"grade": "FAIR", "color": "#f59e0b"},
|
| 168 |
+
50: {"grade": "NEEDS WORK", "color": "#f97316"},
|
| 169 |
+
0: {"grade": "POOR", "color": "#ef4444"}
|
| 170 |
+
},
|
| 171 |
+
|
| 172 |
+
"professional_criteria": {
|
| 173 |
+
"camera_equipment": ["Canon", "Sony", "Leica", "Hasselblad", "Phase One", "ARRI"],
|
| 174 |
+
"lens_specifications": ["f/", "mm", "anamorphic", "telephoto", "wide-angle"],
|
| 175 |
+
"lighting_techniques": ["cinematic", "dramatic", "natural", "studio", "rim light"],
|
| 176 |
+
"composition_rules": ["rule of thirds", "leading lines", "depth of field", "bokeh"],
|
| 177 |
+
"technical_settings": ["aperture", "ISO", "shutter speed", "exposure"]
|
| 178 |
}
|
| 179 |
}
|
| 180 |
|
|
|
|
| 188 |
"space_author": os.getenv("SPACE_AUTHOR_NAME", "")
|
| 189 |
}
|
| 190 |
|
| 191 |
+
# Enhanced BAGEL Prompts for Professional Analysis
|
| 192 |
BAGEL_PROMPTS = {
|
| 193 |
+
"multimodal_analysis": """Analyze this image for professional prompt generation. Provide exactly two sections:
|
| 194 |
+
|
| 195 |
+
1. DESCRIPTION: Create a detailed, flowing paragraph describing the image, including:
|
| 196 |
+
- Image type (photograph, illustration, artwork, scene)
|
| 197 |
+
- Subject matter and composition elements
|
| 198 |
+
- Color palette, lighting conditions, and mood
|
| 199 |
+
- Visual style, artistic elements, and photographic techniques
|
| 200 |
+
- Any cinematic or dramatic qualities
|
| 201 |
+
|
| 202 |
+
2. CAMERA_SETUP: Recommend professional camera and lens setup based on scene analysis:
|
| 203 |
+
- For portraits: High-end camera with portrait lens (85mm-135mm f/1.4-f/2.8)
|
| 204 |
+
- For landscapes: Medium format with wide lens (24-40mm f/4-f/8)
|
| 205 |
+
- For street/documentary: Compact system with standard lens (35mm-50mm f/1.4-f/2.8)
|
| 206 |
+
- For cinematic scenes: Cinema camera with appropriate lens for mood
|
| 207 |
+
- Include specific aperture, focal length, and shooting considerations
|
| 208 |
+
|
| 209 |
+
Focus on creating prompts suitable for multiple generative engines (Flux, Midjourney, etc.).""",
|
| 210 |
+
|
| 211 |
+
"flux_optimization": """Analyze this image for FLUX prompt generation with professional photography principles:
|
| 212 |
+
|
| 213 |
+
1. DESCRIPTION: Detailed scene description focusing on:
|
| 214 |
+
- Visual composition and subject placement
|
| 215 |
+
- Lighting quality, direction, and mood
|
| 216 |
+
- Color relationships and tonal values
|
| 217 |
+
- Artistic style and photographic approach
|
| 218 |
+
- Technical qualities that enhance realism
|
| 219 |
+
|
| 220 |
+
2. CAMERA_SETUP: Professional equipment recommendation:
|
| 221 |
+
- Camera body suitable for the scene type
|
| 222 |
+
- Lens choice with specific focal length and aperture
|
| 223 |
+
- Lighting setup considerations
|
| 224 |
+
- Technical settings for optimal results
|
| 225 |
+
|
| 226 |
+
Generate content optimized for photorealistic output.""",
|
| 227 |
+
|
| 228 |
+
"cinematic_analysis": """Analyze this image for cinematic prompt creation:
|
| 229 |
+
|
| 230 |
+
1. DESCRIPTION: Focus on cinematic elements:
|
| 231 |
+
- Scene composition and framing
|
| 232 |
+
- Lighting mood and dramatic elements
|
| 233 |
+
- Color grading and visual atmosphere
|
| 234 |
+
- Character positioning and environmental context
|
| 235 |
+
- Storytelling visual cues
|
| 236 |
+
|
| 237 |
+
2. CAMERA_SETUP: Cinema-grade equipment:
|
| 238 |
+
- Professional cinema camera recommendation
|
| 239 |
+
- Lens choice for cinematic effect
|
| 240 |
+
- Lighting setup for mood and story
|
| 241 |
+
- Technical considerations for film-quality output
|
| 242 |
+
|
| 243 |
+
Optimize for high-end generative engines with cinematic capabilities."""
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
# Professional Photography Integration Settings
|
| 247 |
+
PROFESSIONAL_PHOTOGRAPHY_CONFIG = {
|
| 248 |
+
"enable_expert_analysis": True,
|
| 249 |
+
"knowledge_base_integration": True,
|
| 250 |
+
"technical_enhancement": True,
|
| 251 |
+
"composition_guidance": True,
|
| 252 |
+
|
| 253 |
+
"scene_detection_keywords": {
|
| 254 |
+
"portrait": ["person", "face", "portrait", "headshot", "model"],
|
| 255 |
+
"landscape": ["landscape", "nature", "mountain", "sky", "horizon"],
|
| 256 |
+
"street": ["street", "urban", "city", "documentary", "candid"],
|
| 257 |
+
"architectural": ["building", "architecture", "structure", "interior"],
|
| 258 |
+
"cinematic": ["film", "movie", "cinematic", "dramatic", "story"],
|
| 259 |
+
"commercial": ["product", "commercial", "advertising", "brand"]
|
| 260 |
+
},
|
| 261 |
+
|
| 262 |
+
"enhancement_priorities": [
|
| 263 |
+
"technical_accuracy",
|
| 264 |
+
"professional_terminology",
|
| 265 |
+
"equipment_specifications",
|
| 266 |
+
"lighting_description",
|
| 267 |
+
"composition_analysis"
|
| 268 |
+
]
|
| 269 |
}
|
| 270 |
|
| 271 |
# Flash Attention Installation Command
|
|
|
|
| 286 |
"SCORING_CONFIG",
|
| 287 |
"ENVIRONMENT",
|
| 288 |
"BAGEL_PROMPTS",
|
| 289 |
+
"PROFESSIONAL_PHOTOGRAPHY_CONFIG",
|
| 290 |
"FLASH_ATTN_INSTALL"
|
| 291 |
]
|