Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barseghyanartur/cc3942b7d1782c8f59bc4f51bb7e7920 to your computer and use it in GitHub Desktop.
Save barseghyanartur/cc3942b7d1782c8f59bc4f51bb7e7920 to your computer and use it in GitHub Desktop.
How to write a Valentine's Day message using Stable Diffusion and Rust

How to write a Valentine's Day message using Stable Diffusion and Rust

A practical guide

Step 1

Use your favorite search engine to search for "stable diffusion image generator". You will find a lot of services. Pick one, for example Night Cafe Creator.

Step 2

Come up with something romantic, like “Two snails on a Valentine’s Day” and generate the image. Play around with settings until you’re satisfied with the result.

8-D62-J1-IY0-Ww-BDW7t-2-small.png

Step 3

Use your imagination to write up a romantic message. I decided to use Rust programming language for that. The “cryptographic” code below translates ASCII codes into a meaningful message “My love will never rust”.

The link below the code is the online code playground. Simply paste your message and click submit to get the output.

use std::char;

fn main() {
    for nword in [
        "77, 121",
        "108, 111, 118, 101",
        "119, 105, 108, 108",
        "110, 101, 118, 101, 114",
        "114, 117, 115, 116",
    ] {
        let mut s = String::new();
        for chr in nword.split(",") {
            s.push(char::from_u32(chr.trim().parse::<u32>().unwrap()).unwrap());
        }
        println!("{:?}", &s);
    }
}

/// https://play.rust-lang.org/

https://play.rust-lang.org/

Outcome

And here it is, your special Valentine’s Day message to your loved one.

You can now share your message with your loved one (using WhatsApp or something similar).

use std::char;
fn main() {
for nword in [
"77, 121",
"108, 111, 118, 101",
"119, 105, 108, 108",
"110, 101, 118, 101, 114",
"114, 117, 115, 116",
] {
let mut s = String::new();
for chr in nword.split(",") {
s.push(char::from_u32(chr.trim().parse::<u32>().unwrap()).unwrap());
}
println!("{:?}", &s);
}
}
/// https://play.rust-lang.org/
@alexrintt
Copy link

I'll definitely use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment