Inspiration
The inspiration for this project came from a fascination with horror literature and the idea of merging it with AI-generated content. I wanted to explore how AI language models and image generators could be combined to create engaging narratives and vivid imagery. Additionally, I was inspired by the idea of providing writers and artists with a tool that could assist them in their creative endeavors.
What it does
The project I worked on was an interactive horror storybook generator that combines the art of storytelling with captivating imagery. The primary goal was to create a tool that could automatically generate a short, unsettling horror story and pair it with custom-generated images to enhance the overall experience.
How we built it
The project's core components were built using Python and relied on several libraries and APIs:
Hugging Face Transformers: This library allowed me to interact with the Mistral-7B-Instruct language model for generating horror stories. I used custom prompts to guide the story generation process.
Image Prompt Generation with Mistral-7B-Instruct: I extended the use of Mistral-7B-Instruct to generate images that corresponded to specific story segments. Each image was tailored to the story's content, creating an eerie and immersive atmosphere.
PIL (Python Imaging Library): PIL was essential for working with images, including filtering, text placement, and combining generated images with blurred backgrounds.
API Integration: The project integrated with Hugging Face APIs for text and image generation. The API endpoints were authenticated using tokens to access the desired models.
Challenges we ran into
While developing this project, several challenges were encountered and addressed:
Text and Image Synchronization: Ensuring that the generated images matched the corresponding text content was a complex task. Coordinating the AI models to align the story with the images required careful orchestration.
Artistic Style Selection: Choosing the appropriate artistic style for each image was a challenge. The project offers several styles, and selecting the one that best suited the horror theme was critical to the overall experience.
Text Layout: Achieving an aesthetically pleasing text layout on images, especially when text length varied, was a demanding task. Implementing a dynamic layout system was necessary to accommodate diverse content.
Image Enhancement: Balancing the blurriness of the background with the clarity of the image was crucial. The Gaussian blur filter was used to create an eerie atmosphere without obscuring the generated image.
What we learned
Throughout the development of this project, I gained valuable insights into several key areas:
AI Language Models: I learned how to leverage AI language models, specifically Mistral-7B-Instruct, for generating creative and contextually relevant horror stories. These models have the ability to take input prompts and generate coherent and engaging narratives.
Image Generation: I explored the world of AI image generation, enabling the project to produce custom illustrations that match the mood and theme of the story. The generated images added depth and immersion to the storytelling experience.
API Integration: I became proficient in using the Hugging Face API to connect with different AI models, including the language model for story generation and the image model for generating visuals.
Challenges and Problem-Solving: I encountered various challenges during the project, such as optimizing text layout within images and finding suitable image styles to match the horror genre. Problem-solving became an integral part of the development process.
Conclusion
The Horror Storybook Generator project has been an exciting exploration of the synergy between AI and creative storytelling. It has provided a platform for users to experience the thrill of both reading and seeing a horror story come to life. The project represents the limitless possibilities of AI in enhancing human creativity and imagination. The journey has been both enlightening and challenging, and I am excited to see how this project can continue to evolve and inspire creators and horror enthusiasts alike.
Built With
- huggingface
- langchain
- python

Log in or sign up for Devpost to join the conversation.