lets clone photoai with rust (still)!

Igor BerlenkoIgor Berlenko
57 min read

Table of contents

No time wasted here, just pure coding efficiency!

VOD people on YouTube, I see you out there watching and waiting for your chance to be awake when I'm also streaming. Let's see, twitch.tv/sler. Alright, what are we going to do? Redacted on top, what's up? You're early, super early. We haven't even started yet; we've been streaming for 40 seconds. Oh my goodness, I love the enthusiasm though, I love the enthusiasm.

Alright, so we're continuing from yesterday and the day before. We're doing projects this time. I'm just going to copy and paste; that's what I'm going to do. We're not gonna—oh, should we talk about CrowdStrike? Just kidding, I don't care. Alright, copy-pasting on top. Oh heck yeah, we're definitely going to copy and paste. What did I call this? I think I called it E draw, which is like the worst name. Alright, so we're just going to copy and paste this bad boy, copy that raw file. That's what I'm talking about. Come over here, give it the Old Source. We're not wasting any time. I don't waste time on this stream.

I use an OSU KB but I remap the keys to control C and control V. That's how you do it. B2. If you don't know, wow, this is a lot. You know what, I'm glad I copy and pasted this because this is a lot. Look at all this debug stuff too. We'll just leave that in there. We'll leave that in there. What did I change? What did I do? Can I zoom out? Oh, tear in reality, there we go. What did I do? You tell me, redacted, you tell me what I did. It seems like the code has changed. The code has changed. I copy and pasted.

Alright, so let's see here. We've got to use—whoa, first we have to mod, right? And we come over here, B2, right? Good. And then what is the main B2 thing? Also, I'm using—I've somehow—oh, I need a lot of stuff. Oh, I need more than just this. I need a lib apparently. I need this too, base 60. I have my own base 64. Okay, we're going to copy this too. Let's go over here. Oh, source, don't worry about that. You know, it took four hours to code it. Wait, it took four hours to code it? Seems so. Either way, my blog has some cool stuff.

And why are you implementing Base 64? Just use a crate. No crates, no crates in here. If you've ever seen this stream before, you know that it's GNA be no crates when I can. I don't use crates. This is actually a pretty bad implementation, to tell you the truth. I reimplemented SHA-1 too. There you go. Drive clone, heck yeah. What's up, Asri Ohus? What's up? Mr. minimalist, look, it keeps the compile times down. It keeps the compile times down. So, we don't need this though. M is a lot here. Oh, I do need this. I did a lot with the environment. I don't know why I was wasting my time with this. Why was I wasting my time?

Building my own async executor for Rust—keeping it simple and thread-local!

Second, okay, there we go. I don't want to leak keys, you know what I mean? Yesterday, I had to rotate my key twice. Honestly, if I find the time, I might make my own async executor for Rust. The way I would do it is more like mono iio and less like Tokyo because I think thread locals are just better for me personally.

I should get that redacted plug-in thing for this. I don't have any caffeine, so I'll give you your points back. I knew I forgot something. Don't worry, I'll give you your points back in a second so you don't waste it. We're almost done with the keys here. I got to log into BackBlaze. Oh, I can show the screen again probably, right?

What is that? Give me my points. We'll do points first. Is it viewer rewards? Is that what we're doing? Is it rewards? No, powerups and channel points. Manage—there's a screen. Here we go. Let's see, can we just reject all? We'll just give everyone their points back because I don't feel like going through it. We'll just reject all and refund. There you go, perfect. Everyone gets their points back, perfect.

My implementation was multi-threaded. Tokyo is multi-threaded. That's what I'm saying; I don't want it to be multi-threaded. I want it to be thread local. It could be multi-threaded, just thread local. It's hard because of the pinning of the Futures. Oh geez, I just showed my key. Dang it. We're going over to Replicate before you guys start sending a bunch of HTTP requests. I got a max limit of $10 on here. Let's go over to the Replicate dashboard, API tokens. Okay, create token. We'll do another one, default with three exclamation points. There you go. Create token. Okay, copy token. Unbelievable. I got to disable the other token too. Disable that token, done.

Alright, so I'm going to copy this. We're going to turn the screen off. It's already disabled; you can't do anything. You have nothing. We'll paste this in here. I'm going to leave the screen off while I sign into BackBlaze because there is some personally identifiable information (PII). Sometimes English or Spanish, no as penol. I don't know how to say it. You can send some requests to Replicate, and my credit card's actually hooked up to that one, so that could cost me some money if you hate me. That's not good.

Setting up tech stuff can be a maze, but persistence pays off!

In the morning, hip-hop is playing, specifically "Static" by Steve Lacy. I like that it's copyright-free, but we're actually doing copyrighted music. There you go. Oh my gosh, two-factor authentication. Let me see. Why are you laughing? Is this like a Rick Roll or something? By the way, let's see, 166. My gosh, trust this browser. Yes, all right.

So, let's see, we're going to make another bucket. We're going to make another bucket, and we're going to make it public. We're going to call it replicate. Okay, our bucket names are interesting. Jeez, we'll just namespace it. There you go, dude. M is very important, please read it. Yeah, the copyright for it is cool. I read that. Play "Static" by Steve Lacy. I already read that. I don't have a "today" command setup. I'm sorry. Okay, here, we'll set it up right now. Let me turn the screen back on. Let me do one thing at a time. Hold on. Let me get these keys in here first.

All right, what? I'm not even sure how to get all these application keys. Oh, I need a new key. Oh my goodness. Wow, we'll do read and write. We'll just use the same key. There's a lot; there's like four different keys. Do whatever this person is saying. I'm definitely 100% gay. Okay, 100% gay. Let me see. All right, okay, we're almost done. Here we go. Kids these days, you know, kids these days. Let me see. All right, I think I'm good. I think I'm good with the keys. I don't think I need to look at keys anymore.

Okay, what was I going to do? I honestly forgot what I was going to do. Yeah, I honestly forgot what I was going to do. Oh, you already read that. Okay, I was kind of reading this right. Blan, what's up? Make a new key and share it. Yeah, all right.

Okay, so let's delete this, and then we can delete this too. Why do I have statically typed? Why do I have statically typed macros? Oh my gosh. We'll just stick it all in the context, right in the state, I guess. It's fine. I guess it gets cloned around, but I don't really care. Actually, you know what? We'll take this and put this over here. Yeah, actually, you know what? Maybe we will keep this, to tell you the truth. Maybe we will keep this.

Messy code can be frustrating, but sometimes you just need to get it working and clean it up later.

Because it was lame, I don't really know anything about CrowdStrike. It's like an Enterprise, like a Norton Antivirus for Enterprise stuff. Is that what it is? Sometimes he's Arch, by the way. It didn't affect me. Well, if I was flying today, I would have been pretty upset with the blue screens, but it seemed like a pretty easy fix to tell you the truth. It just doesn't seem like anyone in IT was around.

We got a high-end security consulting and products, manually reconfiguring every server individually. Yeah, that stinks, but it's not like it's some technical thing, you know what I mean? Let me see, what did I call this? Get AI headshot or something? Is that what I called it? Okay, use Get AI headshot.

Alright, cool. What else do we have here? Oh, wreck. I should just copy this project because it's almost the same. I wonder why I did this. I wrapped the request in my own thing to make it easier. But why did I do this? It's nice to call a function, I guess, but I don't know. I did it, so I'll just do it again, I guess. Whatever. Alright, let's just put it in here though. I don't even know why I put it in its own thing. Alright, we'll switch it. Hold on, we got to switch this. It's like zero-cost abstraction everyone. Oh man, it's so easy to hate on Rust, so easy. We'll listen to one more and then we'll switch.

Let's see, a header map is going to be... we'll just do this. Okay, cool. Header value result is now in here twice. Cool. This is not working out the way I wanted it to. Okay, we just called get, right? What else is request error? Oh, did I not implement error for this? What is result? Oh, that's just a regular result. I don't understand that size for stir, probably because... seems like, oh, we're getting there now. So I just don't have the error implemented. For result, I need a different result. What did I do? I probably have my own result type in here. Implement request error for error. What else did I do? Oh, I see, I put wreck in its own file so I could use the top-level result in these ones. That's annoying. That's alright. Let's see, we could just do this. Okay, so this result is what? Oh, that's B2. What is this result? Oh, I do have my result in main.

Okay, let's find some different music here. I don't know what kind of music we were going to listen to. Whoever said something, but I'm not going to listen to that. Let's see, what else do I have here? We'll listen to some hyperpop. I don't know if anyone likes hyperpop besides me though. Let's see, here we go. It's not really hyperpop, but what are you going to do? I love the type system, that's true. That is true. I guess you don't want to manually reboot a bunch of servers.

Finally got it working after all that effort!

I don't really feel like messing with this right now; I just want to get it working. I already did the work, so why did I do this? Maybe I actually like this macro. I think we're going to keep it.

Alright, so this works. Where did I put the post? Oh, I put it in here. Oh, wrong one. We'll get this keyboard eventually. We'll put this back and do a mod here. Actually, we'll do a mod here in Maine, and then hopefully this works. We might have to B it here.

Hello, what's up? What is hop? What does that mean? Does that have some kind of meaning? Okay, let's see. Request error not implemented. Oh man, that's super annoying. Let's just find my result that I had, and we'll see what I did. I probably did something insane. Let's look at my result here. I mean, I guess it makes sense to always own the result.

Oh, right here. No, no, no. Where is my result? I wonder if we can just search top. Yes, let's just search for result. Oh my gosh, they don't want to do it for private repos. It's the Odin hello world. Oh, okay, hello and alope. I wasn't sure what that was. Yeah, everyone's on Odin. Is Odin pretty memory safe? Should I h what's my time to Segal? Is it pretty high or is it pretty low? I'm saying mine like as a skill issue rust developer.

Let's see, run view run description. I don't think I have. We'll just unwrap. I don't even care at this point. We'll do an expect. We'll at least do an expect, right? B2 o failed. There we go. And then what else? We'll do it here too. I expect what is this get upload URL. Okay, get upload URL failed. One more three points of failure, that's what we're looking at here. Let's see what is oh, this is a big one. Oh, this is a bad oh upload file. Okay, where was I? Upload file failed.

Alright, now we have everything. Oh, what did I change? Oh, m m and then we'll do this and then we'll literally just name them all what they should be. I actually wrap this in API token. Why did I do that? It's an options string. Why can't it just be a string? I wonder why I did that. Oh, probably because it um yeah, oh because I couldn't Implement request parts. That's what that's there's your problem for a local Type M.

Okay, we've got to move M. I think we'll move M. Alright, should we go over the little loav M macro thing? Three stream streak dude, that's a big deal. Allocators Odin are or Odin's allocators are really cool and it has defer so it's pretty difficult to shoot yourself. I think you underestimate me. I am a huge fan of automatic cleanup. Like I know that it's not as efficient and you can't bat defers like in Rust, you can't do it, but honestly, I'm a huge fan of that. That's like half of the reason that I love Rust so much.

We're all just trying to create our own programming languages to solve our unique problems.

Priz, I guess we can go back to like no lyrics, right? But maybe we'll listen to this. Okay, it has a lot of Auto free. Oh, okay, cool, that's sweet. Does Odin have Smart pointers or does ZIG have Smart pointers? I don't even know. All right, so this is cool. Yeah, we don't care about that. What else do we have here? API to... okay, so we don't need that anymore, right? Instead, what we're going to do is, I only had one API token before, but now I have a bunch. So, we'll just do M here. This takes M.

Axim is so nice, it's crazy. M do replicate API token. Oh dude, that's sick. Let's see, let's do replicate API token. We'll just delete this thing. All right, cool. Instead of doing this, we're going to use that classic macro use here. Oh, we had to put it up top. All right, where was I? There we go. Okay, so instead of this, we're going to change this. We're not going to do this anymore because we have macros. Instead of doing this, I can just do this. There we go, done. We could do that a bunch of times.

Right, so we could do B2. Oh my gosh, this is going to be painful with this keyboard. Oh, D key ID. Oh my gosh, ID, there we go. All right, I was going to do the today thing, right? That's what I was going to do. I don't even know how to change that. I really need to be a better streamer, you know, just something I got to work on. It's a personal issue, it's a skill issue really. Let's see, application key, bucket ID. All right, this one doesn't have key B2 key ID. Oh, this one does. All right, key ID name. Okay, cool.

All right, so we've got to... oh, I forgot to do the thing. Replicate, we'll change that with B2 and then we'll do these two. We'll go to API and we'll change that to key. Then here we'll get down to the nitty-gritty. This is application bucket ID. There, finally, my goodness. All right, what else is left? Don't need to do that. Oh, this does take M though. There, all right, what else? That's it, just some warnings. We don't care about warnings. None of the ignorance of the bar checker. Honestly, it's not that annoying, to tell you the truth.

What is this returning chatter? Why is this a thing? Just write your own language at this point. No, just because of macros. Well, that's what we're trying to do. We are trying to write our own language, right? We're actually all trying to do this. That's what's funny. I heard Asing Russ is a nightmare, is that true? No, it's actually funny because we're all trying to write our own languages. I just don't think we realize that we're trying to do it. Oh, maybe I should wait for the ad break to be over.

Created a meme inspired from the stream. Clone, clone, clone. Dude, come on now. Look, you gotta do what you got to do, you know? Let's see, I talk too much. Yeah, like it's funny, macros enable you to do the thing you actually want to do. You don't want to sit down and have co-pilot generate a bunch of boilerplate for you that you're never going to touch again. That's my main problem with Go. My main problem with Go is that you have a bunch of code that gets generated that you're never going to touch, right? You even see stuff at the top of files, "Don't touch this code, it's autogenerated." Just have it built at compile time with a macro.

Macros in Rust can simplify your code by automating repetitive tasks, making your development process more efficient.

In programming, there are often directives at the top of files such as "don't touch this code, it's autogenerated." This code is built at compile time with a macro, and while some may not see the point, macros enable you to achieve what you actually want to do. For instance, using dynamic types or autogenerated code can be beneficial. However, many people in typed programming languages rely heavily on generating numerous functions that they may never actually touch.

The goal of creating our own programming languages and abstractions is to solve specific problems. Macros are compile-time abstractions that allow us to mold the tokens we type into what we actually want. For example, in web development, you might need to embed a directory at compile time in your binary. Traditionally, files like Tailwind CSS and JavaScript were zipped and sent to the server. Nowadays, with Docker, you can package everything, push to GitHub, and get your Docker image from CI.

In Rust, you can embed static files in the binary, compile locally, cross-compile to Linux, and push it to the server via SSH. This simplifies the process significantly. On my server, I use TailScale, a virtual private network, ensuring only I can communicate with the server over SSH.

Macros can generate functions needed to serve static files. For instance, I have a folder called "Static" with Tailwind files. When I call embed static files, it creates the necessary function for Axom to serve those files. Another macro allows me to render these static files in the head of the page, eliminating the need for tools like Webpack.

These macros work together to generate an assets struct at compile time, which includes functions like render static files. Although navigating these macros might be challenging, they significantly reduce repetitive tasks.

In programming, the aim is to eliminate repetitive tasks. Despite some opinions against the DRY (Don't Repeat Yourself) principle, it is beneficial when applied correctly. For instance, macros can map SQL and perform compile-time checks, generating types and functions dynamically. This elevates the programming level, allowing you to focus on higher-level tasks rather than the nitty-gritty details.

Macros simplify complex coding tasks, making development faster and more efficient.

Dry is actually good. I know people often say "dry is not good" and dismiss it, but dry can be beneficial. You don't have to go overboard with it. When it comes to rendering static files or handling database tasks, this is just a quick macro to map SQL and perform some compile-time checking to a function name and structure. All the types are generated, so you see this upload type or insert, which takes a filename string. This abstraction allows me to operate at a higher level without worrying about the nitty-gritty details of mapping SQL to strings. We're now at the application level, which is only possible because we've abstracted away the lower layers. Macros are good, and you can't convince me otherwise.

Now, let's get back to our task. We have B2 and the M's loading. We're going to the router and closing unnecessary tabs. When we upload, Rust is now fast enough to handle direct uploads to S3, which is beneficial. Go interfaces reduce a lot of repetition, and while dynamic types are simple, Go itself is easy, not simple. There's a distinction there. The security mindset is crucial in managing enterprise infrastructure, and I appreciate the control and visibility of the network to limit the attack surface. Tail Scale, written in Go, is amazing.

Switching the music to something faster, let's continue. We're in the upload process. After writing the file, we perform a multi-part upload in Rust using Tokyo. I only care about one field, so I skip the rest. This is how you write asynchronously with Tokyo FS, mirroring the standard library. After writing to the file system, we insert into the database. The DB struct is created by a macro, and all functions fall into place. I can see the SQL by going to the definition.

Yesterday, I encountered an issue due to a missing colon. Now, we need to upload to B2. We need the file name and the file itself. We already have the bytes, so we can move them again since they're not mutable. This is how Rust works. We await the upload and handle any failures with an expect statement. The type checker might need adjustments, but it's manageable.

Switching to Helix from Vim was a game-changer—combines the best of VS Code and terminal editing!

Zed is the new VS Code—faster, better, and ready for the 2020s.

I want to address some misconceptions, especially since Prime became semi-famous. I just want to set the record straight. We're going to upload to B2, and honestly, I think there's nothing wrong with VS Code. If I were to go back to using a GUI editor, I would probably choose Zed. Although I use IntelliJ at work, which I don't like because it's so slow, Zed would be my GUI editor of choice today. VS Code was good for the 2010s, but now we're in the 2020s, and Zed exists. Zed is going to get plugins, and it’s already very fast for a GUI editor.

Regarding B2, Backblaze offers cloud storage, and I trust them more than AWS. Backblaze actually cares about their users and provides valuable data like hard drive failure rates every quarter. They have their own data centers, unlike some services that resell S3. This means if AWS or Google Cloud goes down, you’re not affected if you use Backblaze.

I usually spend some time on an older machine, and VS Code can take a long time to launch. But back to B2, it returns the download URL, which is exactly what I want. We need to replace the current setup with the upload function. Adding a lifetime to avoid using "into" everywhere can be complex, especially with deserialization. Sometimes, owning strings is simpler.

Struggling with Rust lifetimes? Just clone it and move on!

Now, lifetime is defined. Oh my gosh, what is the problem here? Why is this a problem? Can I just do this leaky live types? Consider using the 'a' lifetime. I did use the 'a' lifetime. Then it says, oh, it's because it's the macro. Oh, because I'm here now. Oh my gosh, look at this, the lifetimes are adding up. Oh man, Rust's Achilles' heel. Oh no, now I've got another one. What's this one? Lifetime might not live long enough. This is why I don't use lifetimes. Just clone, just forget it. Forget it, we're just going to use into. Alright, sweet, we're back. We're back. Just a quick, you know, just a quick, uh, just wanted to see how hard it was, you know, just wanted to see. That's why I don't use lifetimes.

Alright, so let me see, we got inos everywhere, who cares? Classic Rust moment. I know we got to show the weaknesses, you know, we got to show the weaknesses. Honestly, lifetimes, who even cares? Who cares, right? We don't care about that. Like, you know, we'll just leak it, we don't even care. Alright, so upload is now the wrong thing. Like, upload is not good. We actually want this to be B2 upload. Right, there we go. And then we could do B2 upload. There we go. Okay, oh no, what did I do? Oh no, now I'm moving things. Oh no, can we just clone this? Clone time. Alright, sweet. And then what's this one? Value moved. Clone, of course, you know it's going to be a clone. You know it's going to be. There we go, perfect. Alright, sweet. That was so funny. Oh, I see because I renamed it upload, so I have moved upload into. Oh my gosh, dude, we can get rid of these CL. We can get rid of them. We don't have to put up with it. We can get rid of them. We can just do this because I really only want the ID here. So I could just do this. We could do upload and then we'll just do ID and we go upload ID and then we can rename this upload. There we go.

There we go. Okay, so now I have moved upload here so I don't need to clone anymore. Go forces you to be, yeah, it's true. R does too. Every language does though. There's not besides LPS, there's not a single language that does the thing. And I had to just get down to the primitives. So once you get down to I64, copies are free, you know, copies are free. It just does the copy, does the right thing. Oh no, it's still, it was a different thing. I do have to clone. Dude, I thought I got around it. I thought I got around it. Dang it. Oh, clone, clone, clone. Alright, good. Who even cares at this point? Who even cares? The clones are free. Okay, clones are free. Enter.

I should have done a defer, right? Alright, let me see. So we're good, right? Wait, what's this? Oh, so we could just rename this back to B2 upload and then we'll do. Oh, this is a really cool feature that's built into Helix. If you do GW, see how every word has like new letters in front of it? So if I, it's like jump on NE ofm. So if I want to go to like upload, right? Like if I want to go to like upload right here, right? Which hand is this? If I want to go to upload, I have to type AZ, right? And then so if I type AZ, the cursor goes straight and no, it's AX, but the cursor goes straight there and then I'm good to go, right? It's really cool. That's like my favorite built-in feature of Helix that I don't have to have a jump plugin for.

Rust isn't perfect, but it helps avoid more errors than C or C++.

Over the years, I've gathered a lot of pointers, and it's hard-won knowledge. For a new language to come in and undo what you've learned through tools like Valgrind and various techniques, it's challenging. Rust is so opinionated that I can see why some people don't like it. They understand the rationale but dislike the strictness of its approach. They want to handle pointers their way and not be constrained by Rust's methods, which is fair. Rust has a lot of opinions, and even with tools like Valgrind, C++, C, Odin, and Zig face similar issues. Even experienced developers with great techniques for mitigating memory safety can still end up with vulnerabilities like CVEs, Heartbleed, and regular expression implementation issues. That's why I use Rust; I know I suffer from pointer segfaults and undefined behavior issues.

As an old-school C programmer, there are things about Rust that annoy me, but I appreciate some of its pillars, so I persevere. Rust isn't a perfect programming language, but it results in fewer CVEs compared to C, C++, Zig, or Odin. The more control you give the programmer, the more errors are likely to occur, which is something people don't like to hear. I saw on Twitter that today's issue with Windows is memory-related, which aligns with my point. I once listened to Jonathan Blow rant about Rust for three hours straight. For games, especially single-player ones, Rust doesn't matter much. Jonathan Blow likes to rant, and I got into his ideas for a while, but I had to step back. I even considered downloading Jai, thinking it might solve my problems, but Jai is built for games, and that's fine.

I hope the AI future enables us to create our own bespoke programming languages, making us super productive. It would be amazing to have our own languages tailored to our needs, without relying on others. We could even have bespoke compiler backends down to the machine code level. That would be a cool future.

Turning a 3MB image into 300KB feels like magic!

It would be sweet, Rex, you have to admit that would actually be a cool future. Alright, so let me see what we are doing. We are going to upload to B2, get the uploaded file HTTP path, pass it to replicate, and then see if it works.

First, let's see. B2 key ID not present. I have to turn off my screen because I don't want to leak this. B2 key ID not present. Oh, right, because this should be M. I ran into this yesterday too. There we go. Actually, this should be right. We are not even doing environment variables anymore; we are going straight from the dotm. Let's see if it works.

This is the back end. You know what, let me change this because it is a flashbang. I'm sorry. We'll give it a little class. We got to do the control R Tailwind. There we go. We need to give it a little class here. What are we going to do? Dark, right? BG gray 950, and then otherwise, we'll do like a BG gray 50 or something. Then dark text, white. There we go. Let's see if we got this. We got it. We'll give it a little style. There, now it's not a flashbang.

Alright, so let me see what we are going to do. Oh, we are going to do merindu. Should we do merindu again? Let me see what the prompt was. We'll just keep with that. We'll do this person because I didn't try this person before. Oh my gosh, three Megs, that's a big image. Let's resize this first. That was a lot. Hang on, let's resize this. Oh my gosh, it's been an hour. I know I should use something, but what are you going to do? Not PNG, jpeg. We got to actually change the size. How do I adjust the size? There it is. We'll do 1280 by 1280. Perfect. There we go, incredible. Went from three Megs to 300K. That's what I like to see.

Okay, upload. A lot of waiting happening. Oh no, what am I expecting? Let's see what we got here. Missing field stream. How is the Json changing? Am I crazy? We did this Json thing. Apparently, there's a field stream that I didn't know about, I guess from replicate. What is it though? Let's go back to the replicate docs. Rindra offered yesterday, so we are going to do it. Let's go back to the, what is it, faer or something? Was it consistency? Oh, consistent character, that's what it was.

Just got raided mid-stream and now we're cloning Photo AI in Rust—let's keep the party going!

Node, there's definitely no stream. What is this music? AGI is coming. Call me Mr. Yogurt. What? Call Mr. Y. Why are you doing this to me? I don't... I like jazz, smooth jazz. I like a little smooth jazz. Free compilers. Yeah, we got to free the compilers. Uh oh, shoot, what just happened? Did I get raided? Wait, hold on, the raid thing didn't go off. Wait, hold on, who's raiding me? What? Oh my God. Okay, oh no, C proced. This can't keep happening though, honestly. Prime, thank you. Shoot, this is... I guess got derailed. We were having such a good time, but now we're going to have a great time. Okay, dang it, this can't keep happening. Shoot, let's just watch them. You know, we'll just watch them for now. We'll just keep it going, we'll keep the party going. Alright, but Prime, thanks. I was just saying yesterday, like if I get raided by someone, I should have like a really cool thing like Baddy has, like a really cool thing. Seth Drums has like a really cool thing. All I can say is thank you, that's all I can do.

Alright, light mode though, enable dark mode. Alright, fine, let's get dark reader. What's happening? Let's get dark reader. Drums in the Deep, yeah, it's true. Hello Peter. Chrome, what's happening? That was easy. Yeah, it was easy. I'll do it, you know, we'll do it. Hello Peter. I'll install anything, anything you guys tell me to install, I'll install it. Alright, did I add the extension? It's happening. Okay, is it enabled? Let's see. There we go. Look, are you happy? Okay, are you? It's all CrowdStrike. Alright, let's go to CrowdStrike. Okay, CrowdStrike. I'm just kidding, I'm not going to install that. Come on, come on now. Hello Peter. Uh, let's see. Install XZ. Still too bright. Come on, come on, it's not too bright. Alright, but thank you, Prime. I would shout you out but hello Peter's... come on, come on. Uh, but yeah, so look, this is what we're doing today. Okay, Raiders, thank you for all the follows, by the way. I know I'm like so... I'm such a bad...

Alright, so this is what we're doing today. Okay, we're cloning Photo AI. So if you haven't seen Photo AI before, this guy, Peter Levels. Okay, oh my gosh, the follows. Like installed. I don't want to tell you what editor I use, alright, because it's going to be nothing but a Non-Stop D's party. Okay, so this is Photo AI. If you can see it, you can't even see it honestly. I'm trying to show you this, Raiders. I'm trying to show you. So, it's this thing that you give it someone's face, you upload selfies, right? Can you see that? You can see it right above. You upload selfies. Thank you for the follows, I appreciate it. And it's not Emac, it's Helix. Okay, Helix. Alright, so you create your own like AI model thing and it does stuff. So I found something similar on Replicate. So here's like an example, right? Here are the examples. So you take this, this was like an image U and then this is the output image, right? So you can put someone in here and then, uh, he looks...

Debugging code feels like starring in my own episode of IT Crowd.

Office Space is funny. Yes, also there was another IT show, I think it was called IT Crowd or something. It was like a British show that I watched. I'm like one of the characters in there. You know, J C plus Lambo link goated levels iio 50k mrr. It's true. Well, we're going to do it in Rust because we don't want Lambos. We don't even want to finish this project; we just want to sit here and mess with lifetimes forever. That's what we're going to do.

IT Crowd was IT Crowd, that's what it is. Yeah, yeah, such a good show. It's a great show. All right, so let me just get back to my debugging. Can we just debug this, please? Can we calm down? I appreciate the follows, thank you. I don't want to minimize the follows. All right, I don't want to minimize. Hello Peter's, okay. All right, so let's get back to this. It said I needed a stream field, but I don't actually know where replicate puts this thing because I was looking at the docs and I still don't know where to put the stream thing. I don't understand it. Maybe we'll look at the reference docs.

Create a prediction. What's happening? Input text status starting. Hello Peter, there is a stream. Look at this version input stream. Oh, this field is deprecated. What's happening? Oh my gosh. You know what, let's take a look. Let's make sure it uploaded to B2. That's what we should do. Deprecated, what's happening? Oh, I reached my... what is that? There was like a little thing. What was that? Wait, hold on. Lead LG true. Let's go, we got the lead. I don't know what that means. What did I even do? I forget what I do sometimes. Let me see. Oh my gosh, deprecated. Refactor Friday. My life is deprecated. No, your life isn't deprecated. Your life is new and shiny.

Oh, follower, that's what it was. Okay, I forgot I set that up. Hello Peter. All right, deprecated, is it? I still need it? Yeah, apparently. Because if I look at this error, missing field stream, right? So we'll put stream in here. Pub stream. I don't know what it is though. What's happening? Let's look at the API reference again. Also, I'm sorry, I'm not going to use co-pilot vs code. Sorry, it's all Helix. All right, let me see. What is this? The stream is... it feels the fields no longer returned, no longer needed as a return. It will always have a stream entry in its URL property. Oh, that's what it is. We need this in the prediction in the URL property. Oh, I have it here. Stream. Hello Peter, what's happening?

Oh, the plot thickens. So, we have input model version get. Hello Peter, thank you. I honestly, it keeps going and I'm kind of overwhelmed and I don't know what to do, so I'm just trying to debug my thing. Hello Peter. Okay, let me see. Output. I'm overstimulated, you know. I need a fidget spinner, that's what I need. All right, let me see. Subject, who's Peter? That guy right there in the cubicles, Peter. Oh, this is the URL. Hello Peter, what's happening? Oh shoot, there's your problem. Hello Peter, what's happening? Uh-oh, that's not good. And that wasn't Safari, don't worry, it wasn't Safari. I swear to you, this is not a Mac. Okay, this is not an M1 Mac Mini. I swear to you. What's happening? Debug your thing. Turn off follower alert. No, no, we'll keep it on. Look, you are in control.

AI is ethically gray, but if it makes money, it's green.

At least four minutes have passed because I have a really cool notification system. Hold on, how do I do this? Activity feed, what's happening? Is it activity? How do I filter? Hello Peter, what's happening? Okay, hold on, I can get rid of this one, I think, right? Do I get rid of that? Hello Peter, it didn't work. Oh my gosh, how do I see this? We'll just scroll. Chris Billows, thank you, I appreciate it. I don't even know this is happening. I'm sorry. Okay, I think that's the only one though. Hello Peter, oh my gosh, it's lithium, probably it's Anonymous. We don't know who it is. We can't speculate, but I appreciate it. Thank you.

Hello Peter, so missing field stream. I'm looking through this JSON, I don't see it, but here we could do this. I'm fairly sure that error is not in here, but you know, we can't tell until we see it in the editor. At least I'm using Alacrity. Hello Peter, his ZD, what's up? Today we're working on cloning Photo AI. So here's what it is: you upload a selfie or any photo. This is ethically a gray area, as all AI stuff is ethically murky because you don't know what it was trained on. But let's, you know, Peter Levels is making like 50k from this, so we got to always be closing. Good, I love that one.

Oh, there's another one, there's going to be 20 of them. First heard train on licensed material. It's funny because I uploaded a picture of me yesterday replicating index DI and Rust. Hey, you know what's funny? You actually want to see something, Igor? You want to see something? I don't know if you're ready for this. If you've never seen the stream before, I made my own web framework called Ride. It's a backend web framework only, right? So it's HDMX. Always be crowd-striking.

So if you look here, there's a lot of macros. Speaking of index.php, this is built so you could see this is a Rust file but there's HTML in here in a proc macro. HTMX mention, yeah, I am a CEO of HTMX. So this DV macro, right? This is Rust but what happens is here I write some SQL, and then I create a function in the macro from the SQL. It automatically creates a function, and the function automatically knows to take the file name as an argument because that's the parameter. It also maps the output as well.

Here you could see that I'm creating this table. You can't actually see, hold on, can we ZT, can we do this? There we go, can we see now? So here you could see right here I'm creating a table. This macro is fantastic, it's incredible. So it's like a conspiracy meme. This creates a table in SQL when I call the function and it also ties this automatically generated upload struct to the table that I made. All of the fields in this table automatically get created in the struct. Always be closing, we are always closing.

Automate your database tasks with macros and save hours of coding!

The function automatically knows to take the file name as an argument, as that's the parameter. It also maps the output as well. Here, you can see that I'm creating this table. You can't actually see it, hold on. Can we zoom in? There we go. Can we see now? Alright, so here you can see that I'm creating a table. This macro is fantastic, it's incredible. It's like a conspiracy meme. This creates a table in SQL when I call the function, and it also ties this automatically generated upload struct to the SQL table that I made. So, all of the fields in this table automatically get created in the struct. Always be closing, always.

I got to fix this. I don't know how Prime does it. Alright, so I can use that same struct here. I'm just going to point right here. I use the same struct here, there, and there. Each of these calls the function, but it's using the same struct from the create table. Prime made my day, he did for sure. Welcome to Costco. I love it. I was just watching Idiocracy last night because I signed up for Hulu and saw they had it. We'll put stream here just because, but I think the real problem is that I didn't do the right thing. Anyway, that's the DB macro. I did actually recreate index.php in Rust.

You can see some other hints here too. Usually in Axom, you can lose your partner status so people can't subscribe. Maybe I should do that, that's actually a good idea. Unfortunately, Helix does not have plugins. I created fobot. Hello Peter, 100%, that's me. You can see some weird stuff, like the DB macro functions are here. Normally in AIM, you have to do this impulse from request parts, but I made a derive macro. It loops through all the fields and implements it, so all this code is generated. I don't have to do this anymore, thank goodness. The only requirement is that the state has to be sent in sync because it's Rust. What are you going to do?

I think we're almost there. I think everyone from Prime's stream almost left. Hello Peter. Back to your proc macro. I should use the CrowdStrike API somehow. Helix, come on Peter, you got to say it at least once. Rust equals the send thing and static, it's true. Let's go back to it. Let's see, we got to try this again. We got to pretty print this because I couldn't see, and I got so distracted. That was the worst I've ever been distracted on the stream, but it happens.

When tech frustration hits, remember to take a deep breath and keep pushing forward.

A little paste, a little percent, a little CH, a little multi-select because we're in Helix. What's happening? We'll just delete, put it back, and save. Pretty printed, so we've got the response. What's happening there is definitely no stream here; that is not a thing that exists. It must just be the file I sent.

Maybe my bucket isn't public. Real liquors, dude. Multi-select this KN of him, multi-select this Helix. Let me see, te DV is RO rolling in his grave right now. He's not even—wait, he's still alive. He's rolling around on the floor. Because I have multi-select, switch to emac. There's no way after yesterday, he definitely leaks. It's true. I know I should have said that; that was weird.

Alright, let me see. I'm too Stam. I gotta calm down. We got to bring it down, bring down the rhetoric in this country. We can't just be at this heightened state all the time. Deep breaths. We have to unite as one country. We can't keep doing this.

Alright, let me see. Can I see the center of the screen? Amazing, yeah, it's great honestly to see the full thing. It's incredible. So, stream is not missing. This download URL is not the URL I want, I don't think, because that's what I'm sending, right? But it seemed like it didn't let me. Oh, there it is. What happened? What am I sending here? Input number of outputs five. Oh, I wonder if it charged me. We got to see if it charged me. Subject is correct, right? What is this leading, what is this trailing slash though? Why is there a trailing SL? Oh, it's not good. Why is there a trailing slash? Is that just for the quote? I think it's just for the quote.

Okay, so it seems like it's good. You can definitely access that file. Let's see if it gives me any more information and replicates thing. Okay, so 20 minutes ago, did it actually go through? Oh, it did. Oh wow, okay, so this actually worked. I don't know why it said there's no stream key, why there's no stream field missing field stream an 89. Why did that happen? Million dollar AWS bill speedrun, true, that's true though.

Yeah, so this worked. Look, you can even see the file from B2. So the beanie, I wonder if she's always in a beanie. Oh yeah, that's so funny. So if you're wearing any headgear, it just stays. Here's the input picture, and it was kind of a weird one because her face isn't dead on, right? But yeah, the prompt definitely put her in a gray sweater because she's in a burgundy thing and now she's in a gray sweater. So it definitely is working. AI is doing a lot of assuming how her face looks from the front, but I think it's okay except for that one. That one's not great.

This feels like a 50k Mr. idea, eigor, you know it. Alright, I'm definitely shooting for 20k, that's all I want. I don't want to go crazy, you know, because I don't have a coffee roaster. Otherwise, I'd rip off terminal coffee, you know, but if I had a coffee roaster, I'd do that.

Don't sleep on Helix, it's the future of text editing!

Terminal coffee, you know, but if I had a coffee roaster, I'd do that. All right, so it's definitely not it. It was definitely the response. We'll put it optional, that's what we're going to do. I know what we're going to do; we'll do it optionally right in the response in the URLs. Oh, I have it here, but sometimes it doesn't exist. Maybe we’ll just make it optional, and then CI will do the right thing. Maybe, I don't know, but it did work.

The next thing we need to do is a different API call. We need to call replicate. Where are the docs? Oh, here, there's even a section on streaming output available for some models. So, what do we do here? Input, oh, there is a stream. Okay, so it's a Boolean. That's interesting. Let's do that. It seems like it's sending multiple requests, which I don't like. Oh, that's not an input, sorry. Right here, there we go. We'll just say stream false. Hello Peter, well it's happening. There we go. He looks at select and verb, that is correct. Right here, true.

Rust is super slow at compiling. Did you see how slow that was? That was horrible. Look how slow that compile was. We're still waiting, actually. We're still waiting for Rust to compile; it's not running. Let's try, you know what, now I know Merre is not here, but we got to do Merindu again because Merre is a big-time supporter of the stream. We got to put his thing. Yesterday, Berre, let's see if he left it up. I wonder if he left it. He did though, he did. So good, so good.

Helix, the cool thing about Helix is that it's less Victorian and more steampunk today. Oh, let's do steampunk. So, the cool thing about Helix is that in Vim, which I was a big Vim user for a long time, like years, but the thing about this is that in Vim you usually do like VI to visual inside. But you can imagine that Helix is always visual. Instead, what you would do in Helix is you would do M, and then it pops up like a little option thing. Then you could do like inside, so for I, and then you could choose the word or the character that you want. For this one, we'll do inside the curries, so now we're inside the outer curly because that's where my cursor was. Now we can delete, so it's ma curly delete.

Why do you want to lose? Tell them it's a Neovim. Yeah, this is Neovim. We're doing Neovim. It's a cool plugin that pops up here; it's really cool. It's popping off in here today. I got rated by Prime, good Advanced tree CER Tut. Basically, the cool thing about Helix is that Tree Sitter is built-in. You don't have to do anything special to get Tree Sitter stuff. Neovim has a lot of legacy from Vim, like the old way to do syntax highlighting. But Helix is deeply integrated with Tree Sitter, which is really cool. Di curly R, it's one less, it's one more character. M Mi I this, but you can see what you're about to do, so you're going to make fewer mistakes. At least I'm going to make fewer mistakes. But I know what you're saying, Vim is like code golf or movement golf, but who cares if it's one extra character?

Every time I try to speed up development, I end up leaking sensitive info—so frustrating!

Helix—okay, don't sleep on Helix, all right? Let me see, where were we? All right, so we're going to try merindu. That's what we're going to do. Where is he? There he is. I wonder if it'll fail because I added stream to the thing. So much for rust, you know? So much for rust. Let me see, I should make some more rust mes.

What's the problem here? Oh no, I'm having the same error from yesterday. I changed the image. What did I do here? Am I about to leak a bunch of stuff? Am I leaking tokens right now? Freak. I got, dude, every day, every day. This is why I don't do stuff like this. This is why I don't do apps on this stream. I always do weird infrastructure stuff, right? I always do weird web framework stuff. Look at all this, oh my gosh. Oh my goodness, I gotta turn my screen off.

I got my credit card connected to back BL. I gotta turn my screen off. I gotta recycle tokens again. Oh my gosh, oh my gosh. Every time. Your secret is safe, yeah, I'm sure it is, Hell Peter. I'm sure it is. Look at how you guys came in here with all the notifications. I'm sure you guys are going to be well-behaved. All right, let me see, what is this? Cue like a thousand Pepe images in my bucket. Hold on a second, let me say, jeez, we gotta get the passwords up here. It's true, it's true. Hello Peter, I should rename my username to something else that has to do with leaking. Hel-leaking more like it. We're not even helixing anymore, the Leen. Unbelievable.

All right, here we go. We gotta redo the application keys. Jeez, man, this stinks. It's such a bummer too, it takes forever. So dumb, so dumb. I gotta look at my logs to figure out what's wrong. God, my goodness. Now I gotta go over, right? I should make something that takes care of this problem. Okay, almost done, jeez. All right, almost there. The black screen of shame is true. That is true though, it is bad. Look, in the pursuit of speed of development speed, I have sacrificed. Okay, I think I got it. In the pursuit of development speed, I have...

NE ofm has a plugin for this kind of stuff. Oh no, switch to e of him. Let me see, let me look at my logging here. So we'll just not do that, right? And I think that's fine. Here, what else do I have here? Oh, I actually have headers being debugged. That's not good. Here, we'll get rid of that too. Okay, oh look at all this, I already commented. I forgot about that. Oh, here we go, there's another one. Okay, so I think this should do it, right? Jeez, we'll get rid of these two. This macro, I don't even know if I'm using this macro. That's fine, right? Debugging their response, I think that's fine.

But let's look if replicate actually did the thing. Oh, we can actually look at the logs now because I recycled the thing. Stream True, so download URL body Stream True input. Okay, did I do stream true? I don't think I wanted to do that. I wanted to do stream false, I think, right? Oh, I did do Stream True. We'll do false. I don't want to stream. All right, let's make sure that it actually went through and cost me money. Let's see where we're at. Actually, Eagle parks of skill issue docs and macro madness.

When tech glitches make you question your life choices but you finally get it to work—priceless!

False, I don't want to stream all right. Let's make sure that it actually went through and cost me money. Let's see where we're at. Actually, Eagle parks of skill issue docs and macro madness—no, it's not macro madness. Okay, it's macro magic. It didn't even hit the API. Oh, what is my total cost? Oh, I've spent 72 cents on what is this, like six requests? Is that what it is? Right, two from the web, but I think I did it's four, right? So four images is like a dollar or five. Five is like a dollar five. So is it five 25? 25 images is a dollar. That's not horrible, right? *10 cents per request, something like that. Well, it's five images per response too. She uses Evo mode like me. Cannot learn how to use other OS. Oh, one more leak Hills of them. No, never. I'll keep leaking forever. I'm never going back.

All right, let me see. So this, I got a 422, but I don't even know why I got a 422. Let's see. So it looks like the upload succeeded. The upload succeeded. I got, okay, so here's the upload succeeding and then, oh, because I tried Stream True probably. That's probably why it failed because it looks like the right URL got sent this time. Yesterday, that was my problem. I wasn't sending the right URL. Now we're okay, I think we're okay. Let's see. Oops, I think we're all right now. Let's try this guy with the glasses. Oh, you couldn't see it. Hold on, we're going to try this guy with the glasses right there. Only leaks tokens, unbelievable. All right, let's see. A lot of loading. There's a lot. I don't like this. There's a lot of loading. What's it even going to do? I think it just redirects back, right? Oh my gosh, if I could get this to work one time. How many, how long have I been streaming? Oh my gosh. Okay, there's no tokens, there's no leaks now. I think we're good, thank goodness.

All right, let me see. You can't see the bucket ID, but I don't think there's any tokens in here. I think we're okay. Look, after the stream, I'll just do it again anyway. Who even cares? Let's see. So body stream false is good. It doesn't like missing field completed. How, where are these coming from? Where are these things? Where I read the docs, I read the stupid docs. Oh my gosh. Create a prediction. I do not see a, is there a more complete response body thing? Get a prediction. Oh, right there. Unbelievable metrics. I'm missing a bunch of stuff. Okay, I did not realize this.

Okay, all right, you want to see something cool? You guys want to see something cool? I'm not going to leak a thing, right? But check this out. So yesterday we figured this out. Actually, it was Rex. So check this out in Rust analyzer. You see that at the top, right? It says JSON syntax not valid. So if you just do an ID action, right? I read the docs. Yeah, look at this. Convert JSON to struct. Okay, it's really cool. Hello Peter. So then happening, you just come back here and you hit enter and then it converts it to structs. Look at this, incredible with serialized and deserialized, right? Oh my gosh, it's amazing. Honestly, it's amazing. And let me get Auto format right. So let's merge data removed with my prediction struct. Can I get this prediction? Can I get where, where was I? Oh, right here. Okay, so we have metrics but we don't have data removed. This is a bummer.

Finding the perfect keyboard is a journey—what works for some might be painfully mid for others.

Because there are so many random fields that are just going to keep failing, I do have some completed out here. I have completed that, but what did it give me? I should just forget distalizing destructs; it's annoying. Created at... oh, it's optional. Oh my gosh, this is so obnoxious, dude. I should just... unbelievable. Okay, okay, and we can make this option too, right? Anyway, that's a really cool trick though, right? The thing... this is a bummer. It seems like it's what you want, but then you don't actually want it, right?

A foar, yeah, we got fard. Yeah, it's a CSA Voyager. Yeah, is that cool? What's that? You know what, in honor of Prime rating me, I did try a Kinesis, but I found it to be mid. You know what I mean? I found the Kinesis to be painfully mid, literally painfully. It gave me pain, so I switched to the Voyager. It's flat, right? Ortholinear. Nightshade, you're mid. You're mid, Nightshade. We're both mid, all right? How do you like that?

So yeah, I switched to this ortholinear, right? Still no concavity. Concavity is not good. Your hands are already concave, but you don't need to... you don't need QWERTY Supremacy. QWERTY Supremacy, that is correct. All right, you got to come correct. So I got... let's see, I got this. We got some... we could put some lights on here, I think. What are we doing? Can we put lights so I can show you? Is it this? Okay, hold on. We've got some stupid RGBs that I turn off. All right, here we go. So I got on this 2x4. Actually, I'll just lift up the 2x4. So I got it on magnets, on little clips, right? And so I have this piece of wood here, and so here you could see the stuff, right? Kind of, kind of a little bit, right? So yeah, there you can see like one half of it. You see that tent too? Look at that tent. It's intense.

So yeah, the one thing I didn't like about the Kinesis was that the tent was mid. Okay, the tent... I like an extreme tent. I like my hands to be like this. You ever seen Grandma's Boy? You ever see Grandma's Boy, and you know JP is in the chair, and he's doing that? That's how it is. Okay, a 90-degree. That's right. See, when you put your hands, stand up and put your hands to your sides, how are your hands, right? They're almost at a 90 just at rest, right? They're almost at a 90. So they're like this, not like this. I want doors like this, not like this. That's how I code. That's not how I code, okay?

Well, something for everyone, you know, but yeah, I got the black one. It's cool. I love it. I think it's sweet. I like the two thumb things. That's on you. The keyboard is camping. Yeah, it does not want to rotate its radius. Yeah, we don't do rotate. We don't need allner deviation in here, okay? But yeah, it's really cool. So these are like the little things, but you can get clamps, and it has really powerful magnets that you can sort of put it on the thing. So yeah, it's really cool. And I also like... I don't like the open-source key mapping thing. I actually really like Oric way better than whatever the Kinesis had.

Speaking of office space, now that I'm just trashing Prime even though he gave here, the Kinesis is good. Like, I will say it's good for people, like certain people, right? How much Ting do you... so like Oric is really cool. I think it's better than whatever the other... what is it called? Z something. Yeah, Oric is incredible. I like it way better.

Mac users know: aesthetics matter, even in keyboards.

Honestly, Zsa, you know I'm a Mac user, so I like the way it looks. The Kinesis looked like it was straight out of the 90s Windows world, you know? I really didn't like the way it looked, and I know I don't look at my keyboard ever, but there's just something about this clean design. It's good for certain people, you know? Everyone has their thing.

Alright, so let me see what other field I might be missing. Let's do something real quick: let's get the prediction and maybe we can actually show the images. Maybe we can show the... you know what? Yeah, let's actually do that. Forget this, because I keep running into this problem. Instead, what we're going to do is... why did I do that? We're just going to stop doing that anymore.

Where are we broken here? Don't look at my B64 thing. Where were we broken? Right there. Instead of a prediction, we're just going to return a string that represents the... actually, we'll do a cool wrapper type like you do in Rust. I can't even type with this thing now; I moved it, so now it's all over the place. Here we go. We'll change this to be just this. There we go. Can we do that? Is that possible?

From here, we're not going to do a CI Json from stir from value. No, we wanted it to be... how do you get CI to do the thing in Rust? CI Json value. Oh my gosh, I'm not using AI; I'm using Duck Duck Go. What's wrong with me? Let me see... represent any... oh, it's just value, right? Is that what it is? Represents a value module Json. Okay, so s Json value. I think I could just deserialize to a value. Is that what it is? From stir into a value. Yes, okay, that's what it is.

Alright, let's see. Should use ala Visa old man out here, you know? 30 Jon value. Can we do that? Is that possible? Alright, so now the prediction is actually going to be this prediction. Why is it doing this? Strange. Let's see... prediction dot get index into a Json array. Definitely not what I want. Or a map. What do we do? Fromer value. Oh, V. Oh, you can actually do this. You could just index like a normal language.

Okay, so we'll do the unsafe thing. Actually, we'll do the safe thing. What does it say here? Get. Okay, so we'll just do the key because I don't actually care to deserialize the whole thing. I don't know what I was doing. I feel like I fall into this "let's type everything all the time" and I really don't care. ID. It's just ID. There you go. ID. And we could do expect because I don't care about errors. ID not found. There, now we'll know what's happening.

Then we'll say prediction here, wrap it into prediction. Good, bad, because I deleted that. There we go. Oh my gosh. Two string, you better believe it. Alright, let's see. So now we return a prediction. It's good. Okay, one more error here. Subscripting thread. Have fun leaking. Alright, we'll see you. Let's see, what is that? What is this? I'm not even reading chat.

Okay, so I have to go in like 10 minutes, so jump if you have to. What is der serialize not... oh wait, what am I doing here? Oh, I'm re-serializing. Yeah, but I actually don't care to store the Json anymore. We'll actually just store... you know what, we'll just return the Json from this thing. From this, and then we'll do this. Okay, that's what we're going to do. Okay, we'll just do this.

Coding in Rust is a journey, not a sprint.

Just return the JSON from this thing, and then we'll do this, okay? That's what we're going to do. We'll just do this, okay? There we go, and then we'll do all that later. Right, there we go. From here, we'll store that response, and then we'll do this. Let PR, let PR. It's not great, though. It's not great, sir. What was it again? I'm going to practice this because I don't know what it is. Value equals definitely don't want to do this, sir. JSON from hster res expect whatever. Can I just do that, actually? I don't think I have the from for this. Oops, wrong one. I don't think I have the, yeah, I definitely don't have that. That would be nice, though. It would be nice to have that. Maybe I should do that. We don't care. We'll just have an expect that's nothing. Oh, I've got, oh no, I've got borrow checker stuff. Clone, okay, clone, clone it. All right, so then we'll go ID. Actually, I only cared to store the JSON, so maybe we don't even need to do this now. Well, we won't even do this because I actually have the JSON in the database, right? Sweet. So now we're doing way less work, which is nice. I just want to see this work one time. One time to not have a deserialization error would be nice.

All right, let's see. We'll change the prompt to put him in a steampunk style suit. That's what we're going to do. All right, let's see. So we'll put Mendra in a steampunk style suit instead. Okay, here we go. Please redirect. My gosh, I forgot to create the table. I never got that far before. Unbelievable. Where is it? Create predictions. Always run your migrations. Create predictions. I don't have a single prediction saved in my database. I don't even know why I was trying to do all that. Okay, here we go. That's what I'm talking about. Although it's showing you the input image and not the output image. So now that I've got a little traction, you know, I want to...

How long have you been coding in Rust? I started yesterday. No, I'm just kidding. I didn't start yesterday. I started... How long has it been? Does anyone here know how long I've been streaming Rust for? Two years? I want to say two years. But I don't want to say that because I'm not actually sure. All right, let me see. Okay, so it's almost the 2-hour mark here. Now that I've done this, I need to make one more call. Go back over to Replicate. I could use a crate, and I probably should use a crate, but I don't want to. I don't want to get prediction, and we'll actually rename this to create. Oops, oh my gosh, this keyboard. On the other hand, yesterday was too many years. Yeah, no, I think it's been two years at this point, but I don't program Rust professionally. So, two years like wall clock time, but on stream, I only stream for like an hour or two a day, and I don't even stream every day. So, to tell you the truth, it's probably somewhere in the months of actual dedicated practice coding Rust. So, yeah, it's not years. It might be like six months, maybe. I don't know. But I've been programming for a lot longer than that, though. Not Rust, but yeah, I've been programming for a long time, and I'm still pretty bad at it.

So, get prediction API token, prediction input, good. And then we will also... Oh, you know what this takes? This takes the prediction ID. That's what it takes. All right, so we're going to do this. We're going to do almost the same thing. We're going to copy this code because we're trying to make money, okay? We're not trying to make great code; we're trying to make great money. That's how it is. All right, so we'll just do a little error handling. I don't want to go too crazy, you know. All right, so ID, we need a different URL. It probably takes something like this, right? We're going to see. It's probably that, but we'll look at the docs because I don't want to be wrong here. I was correct. Okay, there it is. All right, let's see. So then we got... What do we have here? We're looking for... We're going to pull in a loop, and what we're going to do is we're going to look for completed status. Succeeded, that's what we're going to look for, right? Status will be one of starting, processing, succeeded, failed, or canceled. We are going to ignore failed and canceled because there's only success on this stream. There's only success, okay? Failure is not an option. Failure is not going to happen. Status succeeded. So, I guess if I was a good Rust programmer, I would come up with enums and do all kinds of craziness, but we're not going to do that today. We're trying to make money. We're trying to compete with the PHP devs of the world, you know what I'm saying?

What is wrong with this? Oh, this needs to be a reference. That's fine. Create a string just to reference it. Let me see. So, this looks good. It looks good, and the response, I'll just return the same response out. I don't even care. And then what we're going to do is after we go to get headshot, right? We'll do this here. I want this to run in the background, but I need some kind of... This is going to be a little more involved than I thought. I either need to do SSE or a WebSocket, and I don't want to do a WebSocket, but I also have to go, so I can't do this today. The saga continues, okay? But we're making progress every hour or two. We're making progress hour by hour.

All right, so let's see. Who should we raid? I got to go, so who should we raid? Also, raiding, I have mixed feelings about raiding. Let's see. Alt F4. Oh, Alt F4 raided me yesterday, so we will raid today. Right there. Oh no, that is the 3D printer. Oh, we got to get it before he leaves. We got to get them, though. We got to get them. All right, see you. We got to get where he goes. That's weird because he got me yesterday when I was about to leave. All right, it was fun. The stream was fun. I will be back next week, and I will finish this project, I promise. So it unpacked to Source... Oh, damn it. All right, so we need...

Watch: https://youtube.com/watch?v=1M__ct2717k

0
Subscribe to my newsletter

Read articles from Igor Berlenko directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Igor Berlenko
Igor Berlenko