Name Generator

Test this app for free
145
from flask import Flask, render_template, jsonify, request
import random

app = Flask(__name__)

@app.route("/", methods=["GET", "POST"])
def root_route():
    if request.method == "POST":
        era = request.form['era']
        country = request.form['country']
        backstory_request = request.form['backstory'].lower() == 'yes'
        from abilities import llm_prompt
        name_prompt = f"Generate a first name and last name from the era {era} and country {country}"
        generated_name = llm_prompt(name_prompt)
        backstory = ""
        if backstory_request:
            backstory_prompt = f"Generate a backstory for a person named {generated_name} from the era {era} and country {country}"
            backstory = llm_prompt(backstory_prompt)
        return render_template('template.html', name=generated_name, backstory=backstory, display_name=True)
    return render_template('template.html')

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)
Get full code

Created: | Last Updated:

An app that generates names and provides backstories upon user request.

Introduction to the Random Name Generator Template

Welcome to the Random Name Generator template! This template is designed to help you create an application that generates random names based on user input, such as era and country. Additionally, it can provide backstories for the generated names if requested. This step-by-step guide will walk you through using the template on the Lazy platform to build and deploy your name generator app without worrying about environment setup or deployment processes.

Getting Started

To begin using the Random Name Generator template:

  • Click Start with this Template on the Lazy platform.

Test: Deploying the App

Once you have initiated the template:

  • Press the Test button to start the deployment of your app.
  • The Lazy CLI will launch, and the deployment process will begin automatically.

Entering Input

After pressing the Test button:

  • The Lazy App's CLI interface will appear.
  • You will be prompted to provide any necessary user input through the CLI.

Using the App

Once the app is deployed:

  • You will receive a dedicated server link to access the Random Name Generator's interface.
  • Use the web interface to enter the desired era and country, and select whether you want a backstory.
  • Submit the form, and the app will display a randomly generated name along with an optional backstory.

Integrating the App

If you wish to integrate the Random Name Generator into another service or frontend:

  • Use the provided server link as the endpoint for your integration.
  • For API integrations, you may need to add the app's server link to the external tool you are using.
  • Ensure you set the correct scopes or permissions if the external tool requires them.

By following these steps, you can easily create and deploy a Random Name Generator app using the Lazy platform. Enjoy building your application!

Technologies

Similar templates