Malaji71 commited on
Commit
96bcb6f
·
verified ·
1 Parent(s): 8c92505

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +24 -11
models.py CHANGED
@@ -280,22 +280,35 @@ class FallbackAnalyzer(BaseImageAnalyzer):
280
  width, height = image.size
281
  aspect_ratio = width / height
282
 
283
- # Use professional_photography.py to analyze basic image properties
284
- basic_description = f"Professional photograph with {width}x{height} resolution, aspect ratio {aspect_ratio:.2f}"
285
-
286
- # Let professional_photography.py enhance this
287
  try:
288
- enhancement_result = export_professional_prompt_enhancement(
289
- bagel_output=basic_description,
290
- bagel_metadata={"image_size": f"{width}x{height}", "aspect_ratio": aspect_ratio}
291
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
- description = enhancement_result["enhanced_prompt"]
294
- camera_setup = enhancement_result["metadata"].get("technical_context", "")
295
 
296
  except Exception as e:
297
  logger.warning(f"Professional enhancement failed in fallback: {e}")
298
- # Basic fallback
299
  if aspect_ratio > 1.5:
300
  description = "Wide shot composition with natural lighting and balanced framing"
301
  camera_setup = "shot on Phase One XT, 24-70mm f/4 lens, ISO 100"
 
280
  width, height = image.size
281
  aspect_ratio = width / height
282
 
283
+ # Use REAL functions from professional_photography.py
 
 
 
284
  try:
285
+ # Use the REAL function that exists
286
+ from professional_photography import get_professional_camera_setup
287
+
288
+ # Create basic scene description
289
+ if aspect_ratio > 1.5:
290
+ scene_keywords = ["landscape", "outdoor", "wide"]
291
+ basic_description = "Wide shot composition with natural lighting and balanced framing"
292
+ elif aspect_ratio < 0.75:
293
+ scene_keywords = ["portrait", "person", "face"]
294
+ basic_description = "Portrait composition with professional lighting and sharp focus"
295
+ else:
296
+ scene_keywords = ["general", "balanced"]
297
+ basic_description = "Balanced composition with professional execution"
298
+
299
+ # Get professional camera setup using REAL function
300
+ camera_config = get_professional_camera_setup(" ".join(scene_keywords))
301
+ camera_setup = f"shot on {camera_config.get('camera', 'Canon EOS R6')}, {camera_config.get('lens', '50mm f/1.8')}, ISO {camera_config.get('iso', '400')}"
302
+
303
+ # Use REAL enhancement function
304
+ from professional_photography import enhance_flux_prompt_with_professional_knowledge
305
+ enhanced_description = enhance_flux_prompt_with_professional_knowledge(basic_description)
306
 
307
+ description = enhanced_description
 
308
 
309
  except Exception as e:
310
  logger.warning(f"Professional enhancement failed in fallback: {e}")
311
+ # Simple fallback without professional functions
312
  if aspect_ratio > 1.5:
313
  description = "Wide shot composition with natural lighting and balanced framing"
314
  camera_setup = "shot on Phase One XT, 24-70mm f/4 lens, ISO 100"