PoetryApp is a Django-based web application that allows users to explore, create, and manage poetry. A key feature of this app is its integration with the Ollama Qwen2 model to summarize poems, providing insights and concise versions of the poetry content. The app also uses Celery for asynchronous task processing and Redis as the broker for Celery.
- Browse Poetry: Explore a collection of poems.
- Create Poems: Submit your own poetry.
- Manage Poems: Edit and delete your poems.
- Summarize Poems: Use Ollama Qwen2 to generate summaries of poems.
- User Authentication: Register, log in, and manage your account.
- Asynchronous Tasks: Process tasks asynchronously using Celery.
- Docker
- Poetry
- Python 3.8 or higher
- Django 4.0 or higher
- PostgreSQL
- Redis
- Celery
To set up the project using Docker, follow these steps:
-
Clone the Repository
git clone https://github.com/samikshakhadka/PoetryApp.git cd PoetryApp
-
Build and Run Docker Containers
docker-compose up --build
This command will build the Docker images and start the containers defined in your
docker-compose.yml
file. The application, Redis, and Celery workers will be up and running. The application will be accessible athttp://127.0.0.1:8000/
.
If you prefer to set up the project locally using Poetry, follow these instructions:
-
Clone the Repository
git clone https://github.com/samikshakhadka/PoetryApp.git cd PoetryApp
-
Install Dependencies with Poetry
poetry install
-
Activate the Poetry Shell
poetry shell
-
Set Up Redis
Make sure you have Redis installed and running locally. You can download Redis from the official website or use a Docker container.
redis-server
-
Apply Migrations
python manage.py migrate
-
Create a Superuser
python manage.py createsuperuser
-
Run the Development Server
python manage.py runserver
Open your browser and navigate to
http://127.0.0.1:8000/
to view the application. -
Start Celery Workers
In a new terminal, start the Celery worker:
celery -A your_project_name worker --loglevel=info
Replace
your_project_name
with the name of your Django project.
To use the Ollama Qwen2 model for summarizing poems, follow these steps:
-
Install Ollama CLI
Follow the installation instructions from the Ollama documentation to install the Ollama CLI on your local machine.
-
Download the Qwen2 Model
ollama install qwen2
Ensure the model is properly installed and accessible.
-
Configuration
Update your Django settings or environment variables to include the necessary configurations for the Ollama Qwen2 model.
- Register: Create a new account by visiting the registration page.
- Log In: Access your account with your credentials.
- Browse Poetry: View poems in the collection.
- Create Poems: Add new poetry through your profile.
- Manage Poems: Edit or delete your poems as needed.
- Summarize Poems: Use the Ollama Qwen2 integration to generate summaries of poetry.
- Asynchronous Tasks: Celery will handle background tasks such as summarizing poems and other long-running processes.
For details on the available API endpoints, refer to the Swagger documentation, accessible at /swagger/
after starting the server.
To ensure everything is working correctly, run the following command:
python manage.py test
Contributions are welcome! To contribute to PoetryApp:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a Pull Request.
For questions or feedback, please contact:
- Name: Samiksha Khadka
- Email: [email protected]