api_key (str, optional): a DALL-E API keyĮxample: from ascii_magic import AsciiArt api_key = 'SK-AFAKEDALLEAPIKEY' my_art = AsciiArt. from_dalle ( prompt : str, api_key : Optional ) -> AsciiArt The API key can be configured in the module as described in the OpenAI documentation ( openai.api_key = api_key) or through this function call. to_html_file ( 'cow_craiyon.html', columns = 200 )Ĭreates an AsciiArt object with DALL-E, a machine learning model that can generate realistic images from a description in natural language. from_craiyon ( 'A portrait of a cow with noble clothes' ) my_art. prompt (str): a description of an image in natural languageĮxample: from ascii_magic import AsciiArt my_art = AsciiArt.from_craiyon ( prompt : str ) -> AsciiArt to_terminal ( columns = 200, monochrome = True )Ĭreates an AsciiArt object with Craiyon, previously known as DALL-E Mini, a machine learning model that can generate realistic images from a description in natural language. to_html_file ( 'ascii_art.html', columns = 200, width_ratio = 2 )Įxample: from ascii_magic import AsciiArt my_art = AsciiArt. BLUE )Įxample: from ascii_magic import AsciiArt my_art = AsciiArt. to_terminal ( columns = 200, back = Back. path (str): an image file compatible with Pillow, such as a jpeg or pngĮxample: from ascii_magic import AsciiArt, Back my_art = AsciiArt.quick_test () from_image()Ĭreates an AsciiArt object from an image file. quick_test () -> NoneĮxample: from ascii_magic import AsciiArt AsciiArt. Loads a random Unsplash picture with the default parameters and prints it to the terminal, allowing you to verify in a single line of code that everything is running O.K. The property AsciiArt.image exposes the underlying Pillow object so you can manipulate it directly.Įxample: from ascii_magic import AsciiArt from PIL import ImageEnhance my_art = AsciiArt. This class is essentially a wrapper for a Pillow image. to_terminal () # Does the same as this: my_art = from_image ( 'lion.jpg' ) my_art. These methods have parameters such as columns that allow you to change the appearance of the art piece.įor convenience, the module ascii_magic also exposes a collection of functions with the same name as the class methods mentioned above, which do exactly the same.Įxample: from ascii_magic import AsciiArt, from_image # This: my_art = AsciiArt. These objects have multiple methods, such as my_art.to_terminal(), that generate ASCII art pieces from the picture. This module's entire functionality is contained within the class AsciiArt, which has a collection class methods, such as om_image(), that return AsciiArt objects with pictures from different sources: files, URLs, the clipboard, etc. Quickstart from ascii_magic import AsciiArt my_art = AsciiArt. Complete rewrite, full OOP, no longer compatible with 1.x.Stable Diffusion support: from_stable_diffusion().Thanks to Colorama it's compatible with the Windows terminal.Ĭode based on ProfOak's Ascii Py. Python package that converts images into ASCII art for terminals and HTML.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |