diff --git a/.env b/.env index ef24219..a92a374 100644 --- a/.env +++ b/.env @@ -2,4 +2,7 @@ PAGE_ICON = "images/image-to-ascii-art-logo-2.png" PAGE_IMAGE = "images/image-to-ascii-art-logo.png" GITHUB_REPO = "https://github.com/WSE-research/image-to-ascii-art" DESCRIPTION = "\nYou want to create ASCII art from a given picture? Then you've come to the right place. This tool provides a **fast and automated** way to interactively create ASCII art from an existing image (either uploaded from your local machine or download from a URL). You might use this in your applications (e.g., in the `banner.txt` file of [Spring Boot applications](https://www.baeldung.com/spring-boot-custom-banners)). Several methods are implemented here in different approaches for convenient comparison. Some support colorized characters, or colorized background of characters, taking the colors from the given image (see [full feature list](https://github.com/WSE-research/image-to-ascii-art/#image-to-ascii-converter)). Choose for yourself the best approach regarding your image and use case. Have fun.\n\nSee the sidebar for configuring this tool's behavior. For more details, see our [GitHub repository](%s) where you can also [submit bug reports](%s) and [feature requests](%s)." -META_DESCRIPTION = "Create fast and automated ASCII art from images. Upload images or download from a URL. Compare methods interactively, including color/background options. Ideal for applications like Spring Boot banner.txt files." \ No newline at end of file +META_DESCRIPTION = "Create fast and automated ASCII art from images. Upload images or download from a URL. Compare methods interactively, including color/background options. Ideal for applications like Spring Boot banner.txt files." +REPLACE_INDEX_HTML_CONTENT = True +CANONICAL_URL = True +CANONICAL_URL = https://wse-research.org/image-to-ascii-art/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index be74d06..ba6c89a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,9 @@ ENV COLORTERM=24bit # set environment variables for the application ENV UPLOAD_DIRECTORY=/app/working_directory +# do a dry run to see if the applications would starts (so, we are not surprised if it doesn't work during the real start of the container) +RUN (export DRY_RUN=True; export UPLOAD_DIRECTORY="/app/working_directory"; streamlit run image-to-ascii-art-converter-web-ui.py &) && sleep 5 && curl http://localhost:${SERVER_PORT}/ + EXPOSE $SERVER_PORT HEALTHCHECK CMD curl --fail http://localhost:$SERVER_PORT/_stcore/health diff --git a/image-to-ascii-art-converter-web-ui.py b/image-to-ascii-art-converter-web-ui.py index 627bf5f..7382ac5 100644 --- a/image-to-ascii-art-converter-web-ui.py +++ b/image-to-ascii-art-converter-web-ui.py @@ -16,6 +16,7 @@ from ansitoimg.render import ansiToSVG from util import include_css, download_image, save_uploaded_file, replace_values_in_index_html import json +import signal UPLOAD_DIRECTORY = config('UPLOAD_DIRECTORY') EXPORT_IMAGE_ENDING = "-ascii-art.png" @@ -47,6 +48,11 @@ conv = Ansi2HTMLConverter() +# if the dry run is enabled, we will stop the script +if config('DRY_RUN', default=False, cast=bool): + logging.info("dry run enabled, will stop script, now") + os.kill(os.getpid(), signal.SIGTERM) + ascii_image_converter_with_colors = "With colors (I)" ascii_image_converter_with_colors_complex = "With colors (II)" ascii_magic_with_colors = "With colors (III)"