/ficbot

An AI-powered Fan Fiction Writing Assistant.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Ficbot

An AI-powered Fan Fiction Writing Assistant.

Ficbot is a machine learning-based system that provides various tools to make a good starting point for an aspiring writer when they need a character, but don't know where to start.

The main driving force behind this project was the availability of similarly structured anime character data on websites like MyAnimeList.

Moreover, despite different anime studios having different artistic styles, the anime style itself allows character images to make a roughly homogenous dataset, which can be used to help different generation tasks (maybe, even train a GAN? :)

You may experiment with the models using terminal, demo notebooks from this folder, or check out my Flask-based interface.

Features

  • Image -> Name generator

In development:

  • Biography generation;
  • Image generation;
  • Full OC generation;
  • Image anime style transfer (turn yourself into OC?)

Stay tuned for more!

Installation

Install project requirements from requirements.txt

pip3 install -r requirements.txt

Usage example

Simple Image -> Name generation

python3 main.py --image_path example/name/example.jpg --model_path example/name/simple_average.hdf5 --maps_path example/name/maps.pkl --min_name_length 2 --diversity 1.0

Selecting model by inputs and outputs

python3 main.py --inputs image --outputs name

Train model from scratch

python3 main.py --train --model simple_img_name --data_path data/interim/img_name.csv --name_col eng_name --img_col image --img_dir data/raw/images --checkpoint_dir checkpoints --batch_size 16 --epochs 5 --maxlen 3 --optimizer adam

Train model from checkpoint

python3 main.py --train --model simple_img_name --checkpoint example/name/simple_average.hdf5 --maps example/name/maps.pkl --data_path data/interim/img_name.csv --name_col eng_name --img_col image --img_dir data/raw/images --checkpoint_dir checkpoints --batch_size 16 --epochs 5 --maxlen 3

Dataset

The original dataset has been crawled from MyAnimeList.net using Selenium and publicly available Python wrapper for Jikan API.

Raw version of the dataset available here. You can redownload it using the download.py script.

This script requires character links to download character data. You can provide them yourself, or download them using the same script (use --help for more details)

Testing

In order to confirm that the scripts are functional after your requirements have been installed, use:

python3 -m unittest

Test coverage is not complete. You can check test coverage using coverage library for Python. You can install it via

pip3 install coverage

Before generating the report, you need to run the tests using coverage. Current coverage is 73% (all non-ML code and some harder to test ML code, i.e. compilation):

coverage run -m unittest

A simple report can then be generated using:

coverage report