Spaces:
Running
on
Zero
Running
on
Zero
Update enhanced_scene_describer.py
Browse files- enhanced_scene_describer.py +6 -15
enhanced_scene_describer.py
CHANGED
@@ -16,7 +16,7 @@ from confidence_templates import CONFIDENCE_TEMPLATES
|
|
16 |
from landmark_data import ALL_LANDMARKS
|
17 |
from region_analyzer import RegionAnalyzer
|
18 |
from viewpoint_detector import ViewpointDetector, ViewpointDetectionError
|
19 |
-
from template_manager import TemplateManager
|
20 |
from object_description_generator import ObjectDescriptionGenerator, ObjectDescriptionError
|
21 |
from cultural_context_analyzer import CulturalContextAnalyzer, CulturalContextError
|
22 |
from text_formatter import TextFormatter, TextFormattingError
|
@@ -1033,12 +1033,8 @@ class EnhancedSceneDescriber:
|
|
1033 |
|
1034 |
Returns:
|
1035 |
模板內容
|
1036 |
-
"""
|
1037 |
-
|
1038 |
-
return self.template_manager.get_template(category, key)
|
1039 |
-
except (TemplateLoadingError, TemplateFillError) as e:
|
1040 |
-
self.logger.warning(f"Error getting template: {str(e)}")
|
1041 |
-
return None
|
1042 |
|
1043 |
def get_viewpoint_confidence(self, detected_objects: List[Dict]) -> Tuple[str, float]:
|
1044 |
"""
|
@@ -1112,13 +1108,8 @@ class EnhancedSceneDescriber:
|
|
1112 |
def reload_templates(self):
|
1113 |
"""
|
1114 |
重新載入所有模板
|
1115 |
-
"""
|
1116 |
-
|
1117 |
-
self.template_manager.reload_templates()
|
1118 |
-
self.logger.info("Templates reloaded successfully")
|
1119 |
-
except (TemplateLoadingError, TemplateFillError) as e:
|
1120 |
-
self.logger.error(f"Error reloading templates: {str(e)}")
|
1121 |
-
raise EnhancedSceneDescriberError(f"Failed to reload templates: {str(e)}") from e
|
1122 |
|
1123 |
def get_configuration(self) -> Dict[str, Any]:
|
1124 |
"""
|
@@ -1147,4 +1138,4 @@ class EnhancedSceneDescriber:
|
|
1147 |
region_analyzer=self.region_analyzer
|
1148 |
)
|
1149 |
except Exception as e:
|
1150 |
-
self.logger.error(f"Fallback component initialization failed: {str(e)}")
|
|
|
16 |
from landmark_data import ALL_LANDMARKS
|
17 |
from region_analyzer import RegionAnalyzer
|
18 |
from viewpoint_detector import ViewpointDetector, ViewpointDetectionError
|
19 |
+
from template_manager import TemplateManager
|
20 |
from object_description_generator import ObjectDescriptionGenerator, ObjectDescriptionError
|
21 |
from cultural_context_analyzer import CulturalContextAnalyzer, CulturalContextError
|
22 |
from text_formatter import TextFormatter, TextFormattingError
|
|
|
1033 |
|
1034 |
Returns:
|
1035 |
模板內容
|
1036 |
+
"""
|
1037 |
+
return self.template_manager.get_template(category, key)
|
|
|
|
|
|
|
|
|
1038 |
|
1039 |
def get_viewpoint_confidence(self, detected_objects: List[Dict]) -> Tuple[str, float]:
|
1040 |
"""
|
|
|
1108 |
def reload_templates(self):
|
1109 |
"""
|
1110 |
重新載入所有模板
|
1111 |
+
"""
|
1112 |
+
self.template_manager.reload_templates()
|
|
|
|
|
|
|
|
|
|
|
1113 |
|
1114 |
def get_configuration(self) -> Dict[str, Any]:
|
1115 |
"""
|
|
|
1138 |
region_analyzer=self.region_analyzer
|
1139 |
)
|
1140 |
except Exception as e:
|
1141 |
+
self.logger.error(f"Fallback component initialization failed: {str(e)}")
|