This application, developed with Django, functions as the backend system for a Unity frontend application, forming a cohesive Human-AI interactive environment. The platform is central to a thesis project aimed at exploring perceived ownership in human-AI co-creations, with a specific focus on the process of children's storybook creation. Empowered with Django, Django Ninja, and various AI models, it ensures smooth management of storybooks, image operations, and story descriptions in multiple languages.
- Storybooks Management: Facilitates the creation, retrieval, update, and deletion of storybooks via dedicated REST API endpoints
- Image Management: Utilizes Stable Diffusion XL Turbo for the enhancement of images and provides supportive REST API endpoints for image-related operations
- Description Management: Integrates BLIP and TinyLlama AI models to generate story descriptions for storybooks and allows their management via dedicated REST API endpoints
- Multilingual Support: Incorporates Seamless LLM model to translate English text into German, supported by a designated REST API endpoint
- SQLite Database: The application uses SQLite for data storage
- Python 3.x
- Django
- Django Ninja
- SQLite
-
Clone the repository:
git clone https://github.com/dorj222/storybookcreator.git cd storybookcreator
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
-
-
Install dependencies:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
-
Create an environment file (
.env
) in the project root and configure your environment variables:DEBUG=True SECRET_KEY=your-secret-key DATABASE_URL=sqlite:///db.sqlite3 # Add other environment variables as needed
-
Download AI models
wget https://civitai.com
-
Run migrations to apply database changes:
python manage.py migrate
-
Start the development server:
python manage.py runserver
The API will be accessible at http://localhost:8000. Django Ninja provides automated documentation at http://127.0.0.1:8000/api/docs, where you can explore and test the API endpoints interactively.
-
Storybooks:
GET /storybooks
: Retrieve all storybooksGET /storybooks/{storybook_id}
: Retrieve a storybook by IDPOST /storybooks
: Create a new storybookPUT /storybooks/{storybook_id}
: Update a storybook by IDDELETE /storybooks/{storybook_id}
: Delete a storybook by ID
-
Images:
GET /images/{storybook_id}
: Retrieve images associated with a storybookPOST /images/{storybook_id}
: Upload a new image for a storybookPUT /images/{image_id}
: Update an image by IDDELETE /images/{image_id}
: Delete an image by ID
-
Descriptions:
GET /descriptions/getall/{storybook_id}/
: Retrieve all descriptions associated with a storybookGET /descriptions/{description_id}/
: Retrieve a description by IDPOST /descriptions/{storybook_id}/{image_id}
: Upload a new descriptionPUT /descriptions/{description_id}
: Update a description by IDDELETE /descriptions/{description_id}
: Delete a description by ID
-
LLM Features
PUT /chat/translations
: Translate an English text to a target languagePUT /chat/titles
: Generate a storybook title
This project is licensed under the MIT License.