import logging

from flask import Flask, render_template, request, redirect, url_for
from werkzeug.utils import secure_filename
import os
from ascii_art import ASCIIArt
from gunicorn.app.base import BaseApplication

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'uploads/'

ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}

def allowed_file(filename):
    return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS


@app.route("/")
def home():
    return render_template("upload.html")

About this template

AsciiArtify: Convert images into ascii art.

Introduction to the AsciiArtify Template

Welcome to the AsciiArtify template guide. This template allows you to convert images into ASCII art using a simple web interface. The application is built with Flask and can be easily deployed on the Lazy platform. With this template, you won't need to worry about setting up environments or handling deployments, as Lazy takes care of all that for you.

Getting Started

To begin using this template, click on "Start with this Template" in the Lazy Builder interface. This will pre-populate the code in the Lazy Builder, so you won't need to copy or paste any code manually.

Test: Deploying the App

Once you have started with the template, press the "Test" button to begin the deployment of your app. The Lazy CLI will handle the deployment process, and you will not be prompted for any user input at this stage.

Using the AsciiArtify App

After deployment, Lazy will provide you with a dedicated server link. Use this link to access the web interface where you can upload images to be converted into ASCII art. The interface is straightforward:

  • Visit the provided server link.
  • You will see a form where you can upload an image file.
  • Select an image file from your computer (the allowed formats are PNG, JPG, JPEG, and GIF).
  • Click the submit button to upload the image and see the ASCII art representation.

The ASCII art will be displayed directly on the web page after the image is processed.

Integrating the App

If you wish to integrate the ASCII art generation functionality into another service or frontend, you may need to consider the following:

  • Use the server link provided by Lazy as the endpoint for image uploads.
  • Ensure that any external tool you integrate with can send POST requests to the server link with the image data.

For example, if you're integrating with a third-party service that supports webhooks or HTTP requests, you would set up a new webhook or request that targets the "/upload" route of your deployed AsciiArtify app.

Remember, this template is designed to work seamlessly on the Lazy platform, so you can focus on building and integrating your app without worrying about the underlying infrastructure.

If you encounter any issues or have questions about using the template, refer to the documentation provided by Lazy or reach out to their customer support for assistance.

Technology
Last published
July 26, 2024

More templates like this

SecureUserAuthenticator

Develop a secure User Authentication system for users to register, log in, and manage their profiles, laying the foundation for user-specific data management and permissions in the CMS.

Laravel
Python
Flask
Javascript

Simple Multiplayer Telegram game

This app is a simple frontend for a game where users can upvote and downvote the most popular word in their country, learn about the flags of other countries, and view what other people voted for on a leaderboard.

Telegram
Python
Javascript

FALLBACK | Flask, HTML, JS and Tailwind Based Website

This is a good starting point for styled website. It has a header, footer. Has Tailwind and Flowbite loaded so you can build nice looking pages from here.

Flask
HTML
Home
/
AsciiArtify