ihtesham0345 commited on
Commit
4d779c6
·
1 Parent(s): 9a256bc

Reduce to 50 keywords to prevent CPU Timeout (Internal Server Error)

Browse files
Files changed (1) hide show
  1. services/analyzer.py +5 -5
services/analyzer.py CHANGED
@@ -75,9 +75,9 @@ def analyze_seo_content(content: str) -> dict:
75
  "content": f"""Analyze topic: "{content[:2000]}"
76
 
77
  REQUIREMENTS:
78
- - **Core Keywords**: 150 keywords (Extensive Research).
79
- - **Related Phrases**: 20 variations.
80
- - **Viral Hashtags**: 20 tags.
81
  - **Content Titles**: 5 titles.
82
  - **Strategy Tips**: 5 tips.
83
  - **Target Audience**: Profile.
@@ -85,7 +85,7 @@ def analyze_seo_content(content: str) -> dict:
85
  JSON OUTPUT STRUCTURE:
86
  {{
87
  "core_keywords": [
88
- {{"keyword": "...", "search_volume": "...", "competition": "...", "relevance": 90}}, ... (Total 150 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=5000, # Increased for 150 keywords
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**: 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.
 
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
  # 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