ascii_messenger / app.py
Kabatubare's picture
Create app.py
e04075a verified
raw
history blame
874 Bytes
import gradio as gr
import art
def advanced_ascii_art(message, style):
# Use the 'art' package to generate a wide variety of ASCII art styles
try:
ascii_art = art.text2art(message, font=style)
except art.art.ArtError: # Fallback if the style is not found
ascii_art = art.text2art(message) # Default style
return ascii_art
# List of available ASCII art styles from the 'art' package
styles = art.FONT_NAMES
# Create a Gradio interface with an additional dropdown for style selection
iface = gr.Interface(
fn=advanced_ascii_art,
inputs=["text", gr.inputs.Dropdown(choices=styles, label="Style")],
outputs="text",
title="Advanced ASCII Art Generator",
description="Enter your message and select a style to generate advanced ASCII art."
)
# Deploy the app to Hugging Face Spaces with share=True
iface.launch(share=True)