ihtesham0345 commited on
Commit
99776a0
·
1 Parent(s): 4d779c6

Optimize for Speed: 30 Keywords / 1500 Tokens to stop Local CPU Timeout

Browse files
Files changed (1) hide show
  1. services/analyzer.py +8 -8
services/analyzer.py CHANGED
@@ -75,17 +75,17 @@ def analyze_seo_content(content: str) -> dict:
75
  "content": f"""Analyze topic: "{content[:2000]}"
76
 
77
  REQUIREMENTS:
78
- - **Core Keywords**: 50 keywords (Max Safe CPU Limit).
79
- - **Related Phrases**: 15 variations.
80
- - **Viral Hashtags**: 10 tags.
81
- - **Content Titles**: 5 titles.
82
- - **Strategy Tips**: 5 tips.
83
- - **Target Audience**: Profile.
84
 
85
  JSON OUTPUT STRUCTURE:
86
  {{
87
  "core_keywords": [
88
- {{"keyword": "...", "search_volume": "...", "competition": "...", "relevance": 90}}, ... (Total 50 items)
89
  ],
90
  "related_phrases": ["...", ...],
91
  "viral_hashtags": [{{"tag": "#...", "post_count": "..."}}, ...],
@@ -101,7 +101,7 @@ def analyze_seo_content(content: str) -> dict:
101
  # Qwen/HuggingFace pipeline handles chat templates automatically
102
  outputs = pipe(
103
  messages,
104
- max_new_tokens=2500, # Reduced to prevent CPU Timeout
105
  do_sample=True,
106
  temperature=0.7,
107
  top_p=0.9
 
75
  "content": f"""Analyze topic: "{content[:2000]}"
76
 
77
  REQUIREMENTS:
78
+ - **Core Keywords**: 30 high-value keywords (Fast & Stable).
79
+ - **Related Phrases**: 10 variations.
80
+ - **Viral Hashtags**: 8 tags.
81
+ - **Content Titles**: 3 high-probability titles.
82
+ - **Strategy Tips**: 3 actionable tips.
83
+ - **Target Audience**: Concise profile.
84
 
85
  JSON OUTPUT STRUCTURE:
86
  {{
87
  "core_keywords": [
88
+ {{"keyword": "...", "search_volume": "...", "competition": "...", "relevance": 90}}, ... (Total 30 items)
89
  ],
90
  "related_phrases": ["...", ...],
91
  "viral_hashtags": [{{"tag": "#...", "post_count": "..."}}, ...],
 
101
  # Qwen/HuggingFace pipeline handles chat templates automatically
102
  outputs = pipe(
103
  messages,
104
+ max_new_tokens=1500, # Reduced to 1500 for <30s response time
105
  do_sample=True,
106
  temperature=0.7,
107
  top_p=0.9