Spaces:
Running
on
Zero
Running
on
Zero
Update models.py
Browse files
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
|
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 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
|
293 |
-
description =
|
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 |
-
#
|
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"
|