A web application built with Flask and JavaScript that allows users to illustrate their stories using the Stable Diffusion API. This project processes user-submitted stories to generate creative prompts through a keyword selection model and sends them to the Stable Diffusion model for illustration.
You can access the live version of the application hosted on PythonAnywhere at https://teresaacsf.pythonanywhere.com/.
Story Creation: Users can input and edit their stories using a text area.
Automatic Keyword Generation: Generate keywords for images related to the story content with a single click.
Image Generation: Users can input keywords to generate images based on their stories.
Style Selection: Choose from a variety of artistic styles (e.g., Watercolor, Cartoon, Ukiyo-e, Impressionism) to customize illustrations.
Image Viewing: Click on generated images to view them in a modal.
Save Functionality: Users can save their stories for future reference.
Dynamic UI: Add new story parts dynamically with an "Add New Story Part" button.
Suggestions Modal: Offers predefined style suggestions to enhance the story's atmosphere.
- Flask (Python)
- JavaScript
- HTML/CSS
- YAKE (Keyword extraction)
- Stable Diffusion API
To set up the project locally, follow these steps:
- Clone the repository:
git clone https://github.com/teresaacsf/ai-illustrator.git cd ai-illustrator - Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install dependencies
pip install -r requirements.txt
- Run the application
python app.py
Follow these steps to illustrate your stories using the web app:
-
Open the Web Application:
- Navigate to
http://127.0.0.1:5000in your web browser.
- Navigate to
-
Input Your Story:
- In the provided text areas, enter your story. You can fill out multiple text areas to illustrate different parts of your story.
-
Select Keywords (Optional):
- If you wish to generate a prompt automatically, you can use the "Automatic Generation" button. This will extract keywords from your story using the YAKE algorithm.
- Alternatively, you can manually enter a prompt in the corresponding text box below each story input area.
-
Generate the Image:
- Click the "Generate Image" button next to the prompt text area to send your prompt to the Stable Diffusion API. The generated image will be displayed in the image container below each respective text area.
-
View the Generated Images:
- After the processing is complete, the illustrations generated by Stable Diffusion will appear in the designated image containers.
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.
Flask for the web framework Stable Diffusion for image generation YAKE for keyword extraction