ihtesham0345 commited on
Commit
24ee997
·
1 Parent(s): ddcd3d9

Switch to Qwen-1.5B (Lightweight) to fix all API limits

Browse files
Files changed (2) hide show
  1. PROJECT_DOCS.md +1 -1
  2. services/analyzer.py +4 -4
PROJECT_DOCS.md CHANGED
@@ -20,7 +20,7 @@ We used the following technologies to build this application from scratch:
20
  | Component | Technology | Purpose |
21
  | :--- | :--- | :--- |
22
  | **Framework** | **FastAPI** | High-performance web framework for building the API endpoints. |
23
- | **AI Model** | **Google Gemma-2-9b-it** | Google's advanced open model (9B), offering high performance and reasoning. |
24
  | **Connection** | **HF Inference Client** | Connects to Hugging Face's serverless GPU cluster. |
25
  | **Container** | **Docker** | Lightweight container (no heavy ML libraries needed anymore). |
26
  | **Deployment** | **Hugging Face Spaces** | The cloud platform hosting the Docker container. |
 
20
  | Component | Technology | Purpose |
21
  | :--- | :--- | :--- |
22
  | **Framework** | **FastAPI** | High-performance web framework for building the API endpoints. |
23
+ | **AI Model** | **Qwen2.5-1.5B-Instruct** | A lightweight, ultra-fast model chosen for maximum stability on the free tier. |
24
  | **Connection** | **HF Inference Client** | Connects to Hugging Face's serverless GPU cluster. |
25
  | **Container** | **Docker** | Lightweight container (no heavy ML libraries needed anymore). |
26
  | **Deployment** | **Hugging Face Spaces** | The cloud platform hosting the Docker container. |
services/analyzer.py CHANGED
@@ -9,8 +9,8 @@ env_path = Path(__file__).resolve().parent.parent.parent / ".env"
9
  load_dotenv(dotenv_path=env_path)
10
 
11
  # Configuration: Use a powerful model available via free Serverless API
12
- # Gemma-2-9b-it is a strong open model from Google, usually supported on HF Inference.
13
- MODEL_ID = "google/gemma-2-9b-it"
14
 
15
  # Initialize Client
16
  # It automatically picks up HF_TOKEN from environment if set, otherwise works anonymously (with lower limits)
@@ -68,7 +68,7 @@ def analyze_seo_content(content: str) -> dict:
68
  Topic: "{content[:2000]}"
69
 
70
  REQUIREMENTS:
71
- - **Core Keywords**: Provide **50** high-value keywords (Max Safe Limit). Mix of Head Terms, Long-Tail, Questions.
72
  - **Related Phrases**: Provide **20** semantic variations/LSI keywords.
73
  - **Viral Hashtags**: Provide **20** trending hashtags.
74
  - **Content Titles**: Generate **5** high-CTR, click-worthy titles for this topic.
@@ -79,7 +79,7 @@ def analyze_seo_content(content: str) -> dict:
79
  {{
80
  "core_keywords": [
81
  {{"keyword": "keyword 1", "search_volume": "High (50k+)", "competition": "Hard", "relevance": 99}},
82
- ... (Total 50 items)
83
  ],
84
  "related_phrases": [
85
  "phrase 1", "..., ...", "phrase 20"
 
9
  load_dotenv(dotenv_path=env_path)
10
 
11
  # Configuration: Use a powerful model available via free Serverless API
12
+ # Qwen2.5-1.5B is a lightweight, highly stable model for free tier API.
13
+ MODEL_ID = "Qwen/Qwen2.5-1.5B-Instruct"
14
 
15
  # Initialize Client
16
  # It automatically picks up HF_TOKEN from environment if set, otherwise works anonymously (with lower limits)
 
68
  Topic: "{content[:2000]}"
69
 
70
  REQUIREMENTS:
71
+ - **Core Keywords**: Provide **30** high-value keywords (Reliable Set). Mix of Head Terms, Long-Tail, Questions.
72
  - **Related Phrases**: Provide **20** semantic variations/LSI keywords.
73
  - **Viral Hashtags**: Provide **20** trending hashtags.
74
  - **Content Titles**: Generate **5** high-CTR, click-worthy titles for this topic.
 
79
  {{
80
  "core_keywords": [
81
  {{"keyword": "keyword 1", "search_volume": "High (50k+)", "competition": "Hard", "relevance": 99}},
82
+ ... (Total 30 items)
83
  ],
84
  "related_phrases": [
85
  "phrase 1", "..., ...", "phrase 20"