Skip to content

sssingh/pic-to-story

Repository files navigation

title emoji colorFrom colorTo sdk sdk_version app_file pinned license
Picture to Story Generator
📖
yellow
red
gradio
3.46.0
app.py
false
mit

The Storyteller

A Large Language Model Based App to Generate Stories from Pictures



This application employs a Image2Text model hosted by Huggingface, which is a modified adaptation of the Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation (BLIP) model. First, it generates a descriptive caption for an image. Then, it utilizes this caption to construct a prompt, which is subsequently used with OpenAI's GPT-3.5 to create engaging stories based on the provided picture.

App Flow



BLIP Image2Text model details can be foundhere

App Details

  • It's important to note that this sample demonstration app is hosted on the free tiers of Huggingface Spaces, which means it is functional but may exhibit slower performance.
  • Additionally, when using the app for the first time or after an extended period (more than 1 hour), you might encounter an "Internal Error" message or receive a story unrelated to the provided image. This is a normal occurrence during the model loading process. Please wait a few seconds and try again; it should function as intended.
  • Please be aware that due to cost and resource constraints, the app currently has a maximum story length limit of 200 words per request.

App UI is shown below:



Dark Mode Toggle:Activate it to switch between dark and light mode.
Image Selector:Click on it to pick an image from your computer, or drag and drop an image onto it directly. Click the 'X' to clear the selection and resets the app.
Story Genre Dropdown:Select the desired story genre from the dropdown list.
Story Writing Style Dropdown:Select the desired story writing style from the dropdown list.
Story Length (in words) Slider:Adjust the slider to specify the desired length of the generated story.
Creativity Index Slider:Modify the slider to indicate the desired level of creativity for the generated story. A range between 0.5 and 0.7 is recommended. Setting it to 1.0 results in highly creative, sometimes amusing output.
Generate Story Button:Press this button to initiate the story generation process.
Clear Button:Clears all settings and resets the app to its default state.
Story Text Area:This is where the generated story will be displayed.
Example Section Expander:Click to expand the section and access built-in examples for quick testing. Simply select an example, click "Generate Story," and no image upload will be necessary.

The app includes pre-defined examples for your convenience, allowing you to quickly test its capabilities. Explore the examples section, choose one, and click "Generate Story" without needing to upload an image.



Project Source

👉 Visit GitHub Repo

Contact Me

email twitter linkedin website