From 8dec8f00375a57da92c1a3fbbae77b09373479d4 Mon Sep 17 00:00:00 2001 From: shuheykoyama Date: Fri, 23 Feb 2024 03:46:56 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9A=20docs:=20update=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: documentation --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 021a0db..6633347 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # tnap - Let's take a nap πŸ’€ +## What's `tnap`? + +`tnap` is the screen save for TUI. +You can use sample themes for tnap and generate image with default prompts or your own prompts. + ## Examples ### Prompt @@ -17,19 +22,21 @@ ## Usage ``` -Generate image with DALL-E and print it +You can use sample themes for tnap and generate image with default prompts or your own prompts Usage: tnap [OPTIONS] Options: - -p, --prompt Prompt to pass to DALL-E + -t, --theme Use the sample theme without generating images + -k, --key Generate Image by looking up the corresponding value in config.toml using the subsequent string as a key and using it as a prompt + -p, --prompt Generate images with user-considered prompt -a, --ascii Convert an image to ASCII art -h, --help Print help -V, --version Print version ``` ```sh -$ cargo run +cargo run ``` ## License From 5a69ee2da97c755dd30a9d3e3ee2600c85b32d3e Mon Sep 17 00:00:00 2001 From: shuheykoyama Date: Fri, 23 Feb 2024 04:08:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fine-tune?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: fix --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 425b2b7..4713251 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use anyhow::Result; use clap::Parser; +use convert_image_to_ascii::convert_image_to_ascii; use dotenv::dotenv; use generate_image::{download_image, generate_image}; use std::fs; @@ -85,7 +86,11 @@ fn display_generated_image_from_prompt(prompt: &str, ascii: bool) -> Result<()> fn display_image(path: &str, ascii: bool) -> Result<()> { if ascii { - convert_image_to_ascii(&path)?; + let ascii_art = convert_image_to_ascii(Path::new(&path)); + match ascii_art { + Ok(art) => println!("{}", art), // ζˆεŠŸγ—γŸε ΄εˆγ€ASCII γ‚’γƒΌγƒˆγ‚’ε‡ΊεŠ› + Err(e) => println!("Error converting image to ASCII: {:?}", e), // γ‚¨γƒ©γƒΌγŒη™Ίη”Ÿγ—γŸε ΄εˆγ€γ‚¨γƒ©γƒΌγƒ‘γƒƒγ‚»γƒΌγ‚Έγ‚’ε‡ΊεŠ› + } } else { println!("Displaying image: {}", path); // render_image(&path)?;