From 4c69ae15299ac190171b83a65d5543e2ce47e675 Mon Sep 17 00:00:00 2001 From: Ricardo Mancinas Date: Sat, 11 Jul 2026 18:50:46 -0700 Subject: [PATCH] Initial commit: Flask ASCII art generator --- Dockerfile | 15 ++++ app.py | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 Dockerfile create mode 100644 app.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2044b9d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Install Flask +RUN pip install --no-cache-dir flask + +# Copy the app +COPY app.py . + +# Expose port +EXPOSE 5000 + +# Run the app +CMD ["python", "app.py"] diff --git a/app.py b/app.py new file mode 100644 index 0000000..5380b2a --- /dev/null +++ b/app.py @@ -0,0 +1,205 @@ +import random +from flask import Flask, render_template_string, jsonify + +app = Flask(__name__) + +# Collection of ASCII art templates +ASCII_ART = [ + r""" + ╔══════════════════════════╗ + ║ RANDOM ASCII ART ║ + ║ generated ║ + ╚══════════════════════════╝ + """, + r""" + _ + _( ) + (_, /|_ _ + | / \ (_) + \| \|/ + _ + ___| |_ + |_ _| \ + |_| + """, + r""" + / \ + / _ \ + / /_\ \ + /_____\ + \_ _/ + | | + | | + """, + r""" + ┌─────────────┐ + │ (◕‿◕) │ + │ HAPPY! │ + └─────────────┘ + """, + r""" + .---. + / \ + | (.) | + \ / + '---' + """, + r""" + .-. + (o o) + | O | + \ / + `='` + """, + r""" + /\_/\ + ( o.o ) + > ^ < + """, + r""" + ___ + / _ \ + | | | | + | | | | + |_| |_| + """, + r""" + ┌───┐ + │(◉)│ + └───┘ + ^__^ + (__) + """, + r""" + * + /|\ + / | \ + / | \ + /___|___\ + """, + r""" + ,---. + / @_@ \ + | ^ | + \ ___ / + '---' + """, + r""" + ╭──────────╮ + │ SUCCESS │ + ╰──────────╯ + \ / + \ / + \/ + """, +] + +HTML_TEMPLATE = """ + + + + + + Random ASCII Art Generator + + + +

🎲 Random ASCII Art Generator

+
+
{{ art }}
+
+ + + + + +""" + +@app.route('/') +def index(): + art = random.choice(ASCII_ART) + return render_template_string(HTML_TEMPLATE, art=art) + +@app.route('/api/random') +def api_random(): + return jsonify({'art': random.choice(ASCII_ART)}) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=5000)