Malaji71 commited on
Commit
aedfa8a
·
verified ·
1 Parent(s): 3fe3e93

Update professional_photography.py

Browse files
Files changed (1) hide show
  1. professional_photography.py +75 -75
professional_photography.py CHANGED
@@ -259,7 +259,7 @@ EXPERT_PHOTOGRAPHY_KNOWLEDGE = {
259
  "use_carefully": "can be unflattering for portraits"
260
  }
261
  }
262
- }
263
  # =====================================================
264
  # PARTE 2: REGLAS DE COMPOSICIÓN Y TÉCNICAS AVANZADAS
265
  # =====================================================
@@ -497,7 +497,7 @@ EXPERT_PHOTOGRAPHY_KNOWLEDGE = {
497
  "shutter_speed": "1/4s - 2s typically",
498
  "applications": ["creative landscapes", "abstract art", "impressionistic effects"]
499
  }
500
- }
501
  # =====================================================
502
  # PARTE 3: CONFIGURACIONES ISO Y CONDICIONES DE LUZ
503
  # =====================================================
@@ -796,81 +796,81 @@ class ProfessionalPhotoAnalyzer:
796
 
797
  return ", ".join(context_parts)
798
  def _generate_professional_insight(self, scene_type: str, lighting_conditions: Dict[str, Any]) -> str:
799
- """Generate professional photography insight based on scene and lighting"""
800
-
801
- insights = []
802
-
803
- # Scene-specific professional insights
804
- if scene_type == "portrait_studio":
805
- insights.append("Professional studio portraiture requires precise lighting control")
806
- insights.append("3-point lighting setup ensures dimensional modeling of facial features")
807
- elif scene_type == "portrait_exterior":
808
- insights.append("Natural light portraiture benefits from soft, directional lighting")
809
- insights.append("Golden hour provides optimal warmth and flattering illumination")
810
- elif scene_type == "street_photography":
811
- insights.append("Street photography requires anticipation and quick technical adaptation")
812
- insights.append("Available light mastery is essential for authentic documentary capture")
813
- elif scene_type == "landscape":
814
- insights.append("Landscape photography demands patience for optimal natural lighting")
815
- insights.append("Hyperfocal distance technique maximizes front-to-back sharpness")
816
- elif scene_type == "architecture":
817
- insights.append("Architectural photography emphasizes form, texture, and geometric precision")
818
- insights.append("Side lighting reveals dimensional qualities and surface textures")
819
-
820
- # Lighting-specific insights
821
- if lighting_conditions["type"] == "studio":
822
- insights.append("Controlled studio environment allows precise mood and contrast control")
823
- elif lighting_conditions["type"] == "natural":
824
- insights.append("Natural lighting varies continuously, requiring adaptive technical approach")
825
- elif lighting_conditions["type"] == "low_light":
826
- insights.append("Low light conditions demand technical precision and creative interpretation")
827
-
828
- return ". ".join(insights)
829
 
830
- def generate_enhanced_context(self, bagel_description: str) -> Dict[str, Any]:
831
- """
832
- Main method: Generate professional photography context for BAGEL enhancement
833
- NON-INVASIVE: Provides guidance without overriding BAGEL's creativity
834
- """
835
-
836
- # Analyze the image description from BAGEL
837
- scene_type = self.detect_scene_type(bagel_description)
838
- lighting_conditions = self.analyze_lighting_conditions(bagel_description)
839
- composition_guidance = self.get_composition_guidance(scene_type, bagel_description)
840
- technical_context = self.get_technical_context(scene_type, lighting_conditions)
841
-
842
- enhanced_context = {
843
- "scene_type": scene_type,
844
- "lighting_analysis": lighting_conditions,
845
- "technical_context": technical_context,
846
- "composition_guidance": composition_guidance,
847
- "professional_insight": self._generate_professional_insight(scene_type, lighting_conditions),
848
- "equipment_recommendation": self.get_camera_recommendations(scene_type, lighting_conditions)
849
- }
850
-
851
- return enhanced_context
852
 
853
- def format_bagel_enhancement_prompt(self, base_prompt: str, enhanced_context: Dict[str, Any]) -> str:
854
- """
855
- Format enhanced prompt for BAGEL while preserving its creative freedom
856
- """
857
-
858
- context_guidance = f"""
859
-
860
- PROFESSIONAL PHOTOGRAPHY CONTEXT:
861
- Scene Type: {enhanced_context['scene_type'].replace('_', ' ').title()}
862
- Technical Setup: {enhanced_context['technical_context']}
863
-
864
- COMPOSITION CONSIDERATIONS:
865
- {' '.join(enhanced_context['composition_guidance'])}
866
-
867
- PROFESSIONAL INSIGHT:
868
- {enhanced_context['professional_insight']}
869
-
870
- Apply these principles flexibly to enhance your creative analysis.
871
- """
872
-
873
- return base_prompt + context_guidance
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
 
875
 
876
  # =====================================================
 
259
  "use_carefully": "can be unflattering for portraits"
260
  }
261
  }
262
+ },
263
  # =====================================================
264
  # PARTE 2: REGLAS DE COMPOSICIÓN Y TÉCNICAS AVANZADAS
265
  # =====================================================
 
497
  "shutter_speed": "1/4s - 2s typically",
498
  "applications": ["creative landscapes", "abstract art", "impressionistic effects"]
499
  }
500
+ },
501
  # =====================================================
502
  # PARTE 3: CONFIGURACIONES ISO Y CONDICIONES DE LUZ
503
  # =====================================================
 
796
 
797
  return ", ".join(context_parts)
798
  def _generate_professional_insight(self, scene_type: str, lighting_conditions: Dict[str, Any]) -> str:
799
+ """Generate professional photography insight based on scene and lighting"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
800
 
801
+ insights = []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802
 
803
+ # Scene-specific professional insights
804
+ if scene_type == "portrait_studio":
805
+ insights.append("Professional studio portraiture requires precise lighting control")
806
+ insights.append("3-point lighting setup ensures dimensional modeling of facial features")
807
+ elif scene_type == "portrait_exterior":
808
+ insights.append("Natural light portraiture benefits from soft, directional lighting")
809
+ insights.append("Golden hour provides optimal warmth and flattering illumination")
810
+ elif scene_type == "street_photography":
811
+ insights.append("Street photography requires anticipation and quick technical adaptation")
812
+ insights.append("Available light mastery is essential for authentic documentary capture")
813
+ elif scene_type == "landscape":
814
+ insights.append("Landscape photography demands patience for optimal natural lighting")
815
+ insights.append("Hyperfocal distance technique maximizes front-to-back sharpness")
816
+ elif scene_type == "architecture":
817
+ insights.append("Architectural photography emphasizes form, texture, and geometric precision")
818
+ insights.append("Side lighting reveals dimensional qualities and surface textures")
819
+
820
+ # Lighting-specific insights
821
+ if lighting_conditions["type"] == "studio":
822
+ insights.append("Controlled studio environment allows precise mood and contrast control")
823
+ elif lighting_conditions["type"] == "natural":
824
+ insights.append("Natural lighting varies continuously, requiring adaptive technical approach")
825
+ elif lighting_conditions["type"] == "low_light":
826
+ insights.append("Low light conditions demand technical precision and creative interpretation")
827
+
828
+ return ". ".join(insights)
829
+
830
+ def generate_enhanced_context(self, bagel_description: str) -> Dict[str, Any]:
831
+ """
832
+ Main method: Generate professional photography context for BAGEL enhancement
833
+ NON-INVASIVE: Provides guidance without overriding BAGEL's creativity
834
+ """
835
+
836
+ # Analyze the image description from BAGEL
837
+ scene_type = self.detect_scene_type(bagel_description)
838
+ lighting_conditions = self.analyze_lighting_conditions(bagel_description)
839
+ composition_guidance = self.get_composition_guidance(scene_type, bagel_description)
840
+ technical_context = self.get_technical_context(scene_type, lighting_conditions)
841
+
842
+ enhanced_context = {
843
+ "scene_type": scene_type,
844
+ "lighting_analysis": lighting_conditions,
845
+ "technical_context": technical_context,
846
+ "composition_guidance": composition_guidance,
847
+ "professional_insight": self._generate_professional_insight(scene_type, lighting_conditions),
848
+ "equipment_recommendation": self.get_camera_recommendations(scene_type, lighting_conditions)
849
+ }
850
+
851
+ return enhanced_context
852
+
853
+ def format_bagel_enhancement_prompt(self, base_prompt: str, enhanced_context: Dict[str, Any]) -> str:
854
+ """
855
+ Format enhanced prompt for BAGEL while preserving its creative freedom
856
+ """
857
+
858
+ context_guidance = f"""
859
+
860
+ PROFESSIONAL PHOTOGRAPHY CONTEXT:
861
+ Scene Type: {enhanced_context['scene_type'].replace('_', ' ').title()}
862
+ Technical Setup: {enhanced_context['technical_context']}
863
+
864
+ COMPOSITION CONSIDERATIONS:
865
+ {' • '.join(enhanced_context['composition_guidance'])}
866
+
867
+ PROFESSIONAL INSIGHT:
868
+ {enhanced_context['professional_insight']}
869
+
870
+ Apply these principles flexibly to enhance your creative analysis.
871
+ """
872
+
873
+ return base_prompt + context_guidance
874
 
875
 
876
  # =====================================================