- Learn how to create it on YouTube
The Smart Content Recommendation and Generation Platform is a Django-based web application that leverages the Ollama API to generate and recommend content. It provides features like AI-powered content generation, summarization, and tag-based recommendations. Users can register, authenticate, and manage their generated content seamlessly.
- User Authentication: Secure JWT-based authentication for user registration and login.
- Content Generation: Generate high-quality blog posts or articles using the Ollama API.
- Content Summarization: Summarize long articles or blog posts into concise text.
- Tag-Based Recommendations: Get recommendations for similar content based on tags.
- Pagination: Paginated list of user-generated content for better usability.
- Error Handling: Robust error handling for API requests and Ollama integration.
- Backend: Django, Django Rest Framework (DRF)
- AI Integration: Ollama (Llama 3.2 model)
- Authentication: JWT (JSON Web Tokens)
- Database: SQLite (can be replaced with PostgreSQL or MySQL)
- Pagination: DRF's built-in pagination
- Python 3.12+
- Pip (Python package manager)
-
Clone the Repository:
git clone git@github.com:KNehe/smart_content_platform.git cd smart-content-platform
-
Set Up a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Run Migrations:
python manage.py migrate
-
Start the Development Server:
python manage.py runserver
-
Access the API:
- The API will be available at
http://localhost:8000/api/
.
- The API will be available at
-
Register User:
POST /api/register/
- Request Body:
{ "username": "testuser", "password": "testpass123", "email": "test@example.com" }
-
Login (Get JWT Token):
POST /api/token/
- Request Body:
{ "username": "testuser", "password": "testpass123" }
-
Refresh JWT Token:
POST /api/token/refresh/
- Request Body:
{ "refresh": "your-refresh-token" }
-
Generate Content:
POST /api/generate-content/
- Request Body:
{ "topic": "Quantum Computing" }
-
Summarize Content:
POST /api/summarize-content/
- Request Body:
{ "text": "A long article about climate change..." }
-
List User Content:
GET /api/user-content/
-
Get Recommendations:
GET /api/recommendations/<content_id>/
-
Register a User:
curl -X POST http://localhost:8000/api/register/ \ -H "Content-Type: application/json" \ -d '{"username": "testuser", "password": "testpass123", "email": "test@example.com"}'
-
Login and Get JWT Token:
curl -X POST http://localhost:8000/api/token/ \ -H "Content-Type: application/json" \ -d '{"username": "testuser", "password": "testpass123"}'
-
Generate Content:
curl -X POST http://localhost:8000/api/generate-content/ \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"topic": "Artificial Intelligence"}'
-
Get Recommendations:
curl -X GET http://localhost:8000/api/recommendations/1/ \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
smart-content-platform/
├── content/
│ ├── migrations/
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── serializers.py
│ ├── services.py
│ ├── urls.py
│ └── views.py
├── smart_content_platform/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── manage.py
├── requirements.txt
└── README.md
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeatureName
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeatureName
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.