项目作者: EdenBD

项目描述 :
FairyTailor: Multimodal Generative Framework for Storytelling
高级语言: Python
项目地址: git://github.com/EdenBD/MultiModalStory-demo.git
创建时间: 2020-12-04T19:37:37Z
项目社区:https://github.com/EdenBD/MultiModalStory-demo

开源协议:Apache License 2.0

下载


FairyTailor: Multimodal Generative Framework for Storytelling

Human-in-the-loop visual story co-creation

Users can create a cohesive children’s story by weaving generated texts and retrieved images with their input.
With co-creation, writers contribute their creative thinking, while generative models contribute to their constant workflow.
FairyTailor adds another modality and modifies the text generation process to help producing a coherent and creative story.

Demo

Demo Video


Set-up (local development)

Notice (Updated September 17, 2023):
The live demo and dvc downloads are no longer available.

After cloning the repository:

Client (Vue 2.6)

Install and check that the client compiles:

  1. cd client
  2. npm i
  3. npm run build

Backend (FASTAPI)

Install and activate the environment (conda provided):

  1. conda env create -f environment.yml
  2. conda activate MultiModalStory

Install environment globally in the directory:

  1. pip install -e .
  2. pip install git+https://github.com/openai/CLIP.git

After installation run:

  1. python -m spacy download en_core_web_sm

In python terminal:

  1. nltk.download('wordnet')
  2. nltk.download('sentiwordnet')
  3. nltk.download('averaged_perceptron_tagger')

[DEPRECTAED] Large Data Management (dvc)

Our large data files are stored on IBM’s Cloud Object Storage, and to pull data files from that platform you will use a special, read-only .dvc/config file.

  1. dvc pull -f

Which will pull:

  • backend/outputs (five preset stories)
  • backend/story_generator/downloaded (transformers)
  • client/public/unsplash25k (styled images)

Running the framework during developemnt

Client:

  1. cd client
  2. npm run devw

Backend (with server auto reload):

  1. uvicorn backend.server:app --reload --reload-dir backend

Open the uvicorn server localhost:8000 in your web browser

Modifications Ideas:

New huggingface transformer

  • Place the transformer in backend/story_generator/downloaded directory.
  • Update the current model path by changing the constant FINETUNED_GPT2_PATH in backend/story_generator/constants.py.

    New images folder

  • Replace the folder client/public/unsplash25k/sketch_images1024 with yours.
  • Update the current path by changing the constant IMAGE_PATH in client/src/components/Constants.js.

    API functionalities

  • Add functions to the backend endpoint at backend/server/main.py.
  • Update client/src/js/api/mainApi.js to call the backend endpoint from the client.
  • Update the corresponding user components in client/src/components.