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

Switch to SmolLM2 (HF Native) to resolve provider support issues

Browse files
Files changed (2) hide show
  1. PROJECT_DOCS.md +1 -1
  2. services/analyzer.py +3 -3
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** | **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. |
 
20
  | Component | Technology | Purpose |
21
  | :--- | :--- | :--- |
22
  | **Framework** | **FastAPI** | High-performance web framework for building the API endpoints. |
23
+ | **AI Model** | **SmolLM2-1.7B-Instruct** | Hugging Face's own efficient model, ensuring maximum free-tier compatibility. |
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
- # 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)
@@ -107,7 +107,7 @@ def analyze_seo_content(content: str) -> dict:
107
  try:
108
  response = client.chat_completion(
109
  messages=messages,
110
- max_tokens=8000,
111
  temperature=0.7,
112
  top_p=0.9
113
  )
 
9
  load_dotenv(dotenv_path=env_path)
10
 
11
  # Configuration: Use a powerful model available via free Serverless API
12
+ # SmolLM2 is Hugging Face's own efficient model - highly likely to be supported free.
13
+ MODEL_ID = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
14
 
15
  # Initialize Client
16
  # It automatically picks up HF_TOKEN from environment if set, otherwise works anonymously (with lower limits)
 
107
  try:
108
  response = client.chat_completion(
109
  messages=messages,
110
+ max_tokens=2000,
111
  temperature=0.7,
112
  top_p=0.9
113
  )