Harshit Pathak 3 mesiacov pred
rodič
commit
03c7963ca1

BIN
content_quality_tool/__pycache__/settings.cpython-313.pyc


BIN
content_quality_tool/__pycache__/urls.cpython-313.pyc


BIN
core/__pycache__/urls.cpython-313.pyc


BIN
core/__pycache__/views.cpython-313.pyc


BIN
core/services/__pycache__/attribute_scorer.cpython-313.pyc


BIN
core/services/__pycache__/gemini_service.cpython-313.pyc


+ 27 - 9
core/services/attribute_scorer.py

@@ -640,16 +640,29 @@ class AttributeQualityScorer:
             logger.warning(f"Content Rules scorer not available: {e}")
 
         # UPDATED WEIGHTS (Total = 100%)
+        
+        # self.weights = {
+        #     'mandatory_fields': 0.16,
+        #     'standardization': 0.12,
+        #     'missing_values': 0.08,
+        #     'consistency': 0.04,
+        #     'seo_discoverability': 0.08,
+        #     'content_rules_compliance': 0.12,
+        #     'title_quality': 0.08,
+        #     'description_quality': 0.12,
+        #     'image_quality': 0.20
+        # }
+
         self.weights = {
-            'mandatory_fields': 0.16,
-            'standardization': 0.12,
-            'missing_values': 0.08,
-            'consistency': 0.04,
-            'seo_discoverability': 0.08,
-            'content_rules_compliance': 0.12,
-            'title_quality': 0.08,
-            'description_quality': 0.12,
-            'image_quality': 0.20
+            'mandatory_fields': 0.25,
+            'standardization': 0.00,
+            'missing_values': 0.00,
+            'consistency': 0.00,
+            'seo_discoverability': 0.00,
+            'content_rules_compliance': 0.00,
+            'title_quality': 0.15,
+            'description_quality': 0.25,
+            'image_quality': 0.35
         }
 
     def score_product(
@@ -783,9 +796,14 @@ class AttributeQualityScorer:
             component_status['image_quality'] = "Image scorer not available"
 
         # --- Final Score Calculation: use only numeric scores ---
+        print(scores.items())
         numeric_scores = {k: v for k, v in scores.items() if isinstance(v, (int, float))}
+        print("numeric score is")
+        print(numeric_scores)
         applicable_weights = {k: self.weights[k] for k in numeric_scores}
+
         total_weight = sum(applicable_weights.values())
+        print(f"total sum taking wt in consideration is: {total_weight}")
         if numeric_scores and total_weight > 0:
             final_score = sum(numeric_scores[k] * (applicable_weights[k] / total_weight) for k in numeric_scores)
         else:

+ 2 - 2
core/services/gemini_service.py

@@ -469,7 +469,7 @@ class GeminiAttributeService:
         if not api_key:
             raise ValueError("GEMINI_API_KEY not found in settings")
         genai.configure(api_key=api_key)
-        self.model = genai.GenerativeModel('gemini-2.5-flash')
+        self.model = genai.GenerativeModel('gemini-2.5-flash-exp')
     
     @retry(
         stop=stop_after_attempt(3),
@@ -621,7 +621,7 @@ Return ONLY this JSON structure:
       "confidence": "high/medium/low"
     }}
   ],
-  "quality_score_prediction": 85,
+  "quality_score_prediction": 93.25,
   "summary": "Brief 2-3 sentence summary of key improvements needed"
 }}
 

+ 2 - 2
core/views.py

@@ -647,7 +647,7 @@ class BatchScoreViewV2(View):
         start = time.time()
         sku = product_data.get('sku')
         category = product_data.get('category')
-
+        img_raw_path = product_data.get('image_path')
         if not sku or not category:
             return {'sku': sku, 'error': 'Missing SKU or category'}
 
@@ -714,7 +714,7 @@ class BatchScoreViewV2(View):
                 'sku': sku,
                 'title': product_data.get('title'),
                 'description': product_data.get('description'),
-                'image_path': image_path,
+                'image_path': img_raw_path,
                 'final_score': score_result['final_score'],
                 'max_score': score_result['max_score'],
                 'breakdown': {**score_result['breakdown'], 'image_score': image_score_result.get('image_score')},