by moonboy

BookGen

Test this app for free
30
import logging
from flask import Flask
from gunicorn.app.base import BaseApplication
from markupsafe import Markup
import json
from routes import register_routes
from models import db
from migrations.run_migrations import run_migrations

def create_app():
    app = Flask(__name__, static_folder='static')
    app.secret_key = 'supersecretkey'
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.sqlite'
    db.init_app(app)
    with app.app_context():
        run_migrations(app)
    register_routes(app)
    app.jinja_env.filters['from_json'] = lambda x: json.loads(x)
    app.jinja_env.filters['join'] = lambda x, sep: Markup(sep).join(x)
    return app

app = create_app()

# Setup logging
Get full code

BookGen

Created: | Last Updated:

An app to generate customised books of various styles using AI from kids stories to romance.

Here's a step-by-step guide for using the BookGen template:

Introduction to the BookGen Template

The BookGen template allows you to create a web application that generates customized books of various styles using AI. From children's stories to romance novels, this app provides an interface for users to input their preferences and receive AI-generated book content.

Getting Started

To begin using this template:

  1. Click the "Start with this Template" button in the Lazy Builder interface.

Test the Application

After the template loads:

  1. Click the "Test" button to deploy the application and launch the Lazy CLI.

Using the BookGen App

Once the app is deployed, you'll be provided with a server link to access the web interface. Here's how to use the application:

  1. Open the provided server link in your web browser.

  2. On the home page, you'll see options to register or log in.

  3. If you're a new user, click on "Register" and fill out the registration form with your username, email, and password.

  4. After registering or logging in, you'll be redirected to the home page.

  5. Click on the "Generate Book" button to start creating your custom book.

  6. On the book generation page:

  7. Select a book style (e.g., Children's Story, Fantasy, Science Fiction, Mystery, Romance)
  8. Enter a brief story idea in the "Story Idea" text area
  9. Provide custom character information in the "Custom Character Information" text area
  10. Choose the number of chapters for your book

  11. Click the "Generate Book" button to start the AI-powered book creation process.

  12. Once the book is generated, you'll be redirected to a page where you can view your book's title, outline, and full content.

  13. To access your generated books later, click on the "My Books" link in the navigation menu.

Customizing the App

The BookGen template provides a solid foundation for an AI-powered book generation app. You can further customize the app by:

  • Modifying the styles.css file to change the app's appearance
  • Adjusting the book generation options in the generate_book.html file
  • Enhancing the book generation logic in the book_generator.py file

Remember that all customizations and development should be done within the Lazy Builder interface.

By following these steps, you'll have a fully functional AI-powered book generation app up and running on the Lazy platform.

Technologies