Spaces:
Sleeping
Sleeping
| from services.utils import run_analysis | |
| SYSTEM_PROMPT = """You are an SEO strategist. Return ONLY a valid JSON object (not an array) with keywords, hashtags, content titles, strategy tips, and target audience.""" | |
| DEFAULTS = { | |
| "core_keywords": [{"keyword": "topic guide", "search_volume": "Medium", "competition": "Medium", "relevance": 85}], | |
| "related_phrases": ["related topic ideas"], | |
| "viral_hashtags": [{"tag": "#Topic", "post_count": "100K+"}], | |
| "content_titles": ["Complete Guide", "Top Tips", "Beginners Guide"], | |
| "strategy_tips": ["Focus on user intent.", "Optimize for long-tail keywords.", "Improve meta tags."], | |
| "target_audience": "General Audience interested in this topic." | |
| } | |
| def analyze_seo_content(content: str) -> dict: | |
| messages = [ | |
| {"role": "system", "content": SYSTEM_PROMPT}, | |
| {"role": "user", "content": f'Topic: "{content[:1000]}"\nReturn a JSON object (not an array) with these keys:\n- core_keywords (5 items, each with "keyword" + "search_volume" + "competition" + "relevance")\n- related_phrases (3 items)\n- viral_hashtags (3 items, each with "tag" + "post_count")\n- content_titles (3 items)\n- strategy_tips (3 items)\n- target_audience (string)'} | |
| ] | |
| return run_analysis(messages, defaults=DEFAULTS, temperature=0.3, max_new_tokens=800) | |