{"id":108,"date":"2024-11-21T05:15:53","date_gmt":"2024-11-21T05:15:53","guid":{"rendered":"https:\/\/rhwbaldwin.com\/blog\/?p=108"},"modified":"2024-12-07T20:27:04","modified_gmt":"2024-12-07T20:27:04","slug":"introducing-leoandruby-simplifying-ai-powered-image-generation-for-ruby-developers","status":"publish","type":"post","link":"https:\/\/rhwbaldwin.com\/blog\/2024\/11\/21\/introducing-leoandruby-simplifying-ai-powered-image-generation-for-ruby-developers\/","title":{"rendered":"Introducing LeoAndRuby: Simplifying AI-Powered Image Generation for Ruby Developers"},"content":{"rendered":"\n<a href=\"https:\/\/badge.fury.io\/rb\/leoandruby\"><img decoding=\"async\" src=\"https:\/\/badge.fury.io\/rb\/leoandruby.png?icon=si%3Arubygems\" alt=\"Gem Version\" height=\"18\"><\/a>\n\n\n\n<p>Today, I\u2019m thrilled to announce the launch of <strong><a href=\"https:\/\/rubygems.org\/gems\/leoandruby\" data-type=\"link\" data-id=\"https:\/\/rubygems.org\/gems\/leoandruby\" target=\"_blank\" rel=\"noreferrer noopener\">LeoAndRuby<\/a><\/strong>, a brand-new Ruby gem that makes it easier than ever to harness the power of AI for image generation. With just a few lines of code, developers can integrate cutting-edge image generation capabilities from the <a href=\"https:\/\/leonardo.ai\/\">Leonardo.ai API<\/a> into their Ruby applications.<\/p>\n\n\n\n<p>Whether you&#8217;re building a Rails application, a standalone script, or exploring the creative possibilities of AI-generated art, <strong><a href=\"https:\/\/rubygems.org\/gems\/leoandruby\" data-type=\"link\" data-id=\"https:\/\/rubygems.org\/gems\/leoandruby\" target=\"_blank\" rel=\"noreferrer noopener\">LeoAndRuby<\/a><\/strong> is here to simplify your workflow.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Why LeoAndRuby?<\/strong><\/h4>\n\n\n\n<p>The rise of generative AI has opened up incredible possibilities, but integrating these tools into your Ruby projects hasn&#8217;t always been straightforward. With <strong>LeoAndRuby<\/strong>, I set out to solve that problem by providing:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simplicity<\/strong>: A clean, intuitive API that works seamlessly with Ruby and Rails.<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: Full access to Leonardo.ai\u2019s powerful image generation capabilities, including custom prompts, model selection, and resolution settings.<\/li>\n\n\n\n<li><strong>Efficiency<\/strong>: A lightweight gem that takes care of the heavy lifting so you can focus on building great software.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What Can You Do With LeoAndRuby?<\/strong><\/h4>\n\n\n\n<p>Here are just a few of the exciting possibilities:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Generate stunning visuals<\/strong> for your web or mobile applications.<\/li>\n\n\n\n<li><strong>Experiment with AI creativity<\/strong>, crafting unique prompts to explore new ideas.<\/li>\n\n\n\n<li><strong>Incorporate AI-generated images into Rails workflows<\/strong>, from product galleries to dynamic user-generated content.<\/li>\n<\/ul>\n\n\n\n<p>With the versatility of the Leonardo.ai API and the power of Ruby, the possibilities are endless.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Key Features<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Simple API Integration<\/strong><br>Quickly connect to Leonardo.ai with your API key and start generating images in minutes.<\/li>\n\n\n\n<li><strong>Customizable Parameters<\/strong><br>Define the prompt, model, resolution, and more to tailor the results to your needs.<\/li>\n\n\n\n<li><strong>Asynchronous Workflows<\/strong><br>LeoAndRuby handles the waiting game for image generation, making it easy to poll for results when they\u2019re ready.<\/li>\n\n\n\n<li><strong>Rails-Friendly<\/strong><br>Designed with Rails in mind, the gem works seamlessly with service objects, controllers, and background jobs.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>How to Get Started<\/strong><\/h4>\n\n\n\n<p>Getting started with LeoAndRuby is quick and easy:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Install the Gem<\/strong> Add the gem to your project by running:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   gem install leoandruby<\/code><\/pre>\n\n\n\n<p>Or include it in your <code>Gemfile<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   gem 'leoandruby'<\/code><\/pre>\n\n\n\n<p>Then, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   bundle install<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Set Up Your API Key<\/strong> Sign up at <a href=\"https:\/\/leonardo.ai\/\">Leonardo.ai<\/a> and get your API key. Store it securely in your environment:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   export LEOANDRUBY_API_KEY=your_api_key<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Generate Your First Image<\/strong> Use the gem to generate your first image:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   require 'leoandruby'\n\n   client = LeoAndRuby::Client.new(ENV&#91;'LEOANDRUBY_API_KEY'])\n\n   response = client.generate_image(\n     prompt: 'A futuristic cityscape at sunset',\n     model_id: '6bef9f1b-29cb-40c7-b9df-32b51c1f67d3',\n     width: 1024,\n     height: 768\n   )\n\n   puts response<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Behind the Scenes: The Journey to Launch<\/strong><\/h4>\n\n\n\n<p>Building <a href=\"https:\/\/rubygems.org\/gems\/leoandruby\" data-type=\"link\" data-id=\"https:\/\/rubygems.org\/gems\/leoandruby\" target=\"_blank\" rel=\"noreferrer noopener\">LeoAndRuby<\/a> was a labor of love. I\u2019ve always been fascinated by the intersection of technology and creativity, and this project gave me a chance to combine my passion for Ruby development with the cutting-edge capabilities of AI. From designing the gem\u2019s architecture to testing it in Rails applications, every step of the journey was about making AI image generation accessible to Ruby developers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What\u2019s Next for LeoAndRuby?<\/strong><\/h4>\n\n\n\n<p>This is just the beginning! Future updates will include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Support for advanced API features<\/strong> like fine-tuned models and custom training.<\/li>\n\n\n\n<li><strong>Background job integration<\/strong>, making it easy to generate images asynchronously in Rails apps.<\/li>\n\n\n\n<li><strong>Enhanced error handling and logging<\/strong> for more robust workflows.<\/li>\n<\/ul>\n\n\n\n<p>I\u2019m excited to see how the community uses LeoAndRuby, and I\u2019m looking forward to hearing your feedback.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Join the Community<\/strong><\/h4>\n\n\n\n<p>LeoAndRuby is open source and hosted on GitHub. I\u2019d love for you to join the community:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Explore the code<\/strong>: <a href=\"https:\/\/github.com\/RWKotulski\/leoandruby\">GitHub Repository<\/a><\/li>\n\n\n\n<li><strong>Report issues or suggest features<\/strong>: <a href=\"https:\/\/github.com\/RWKotulski\/leoandruby\/issues\">Submit an Issue<\/a><\/li>\n\n\n\n<li><strong>Contribute<\/strong>: Fork the repository and submit a pull request!<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Let\u2019s Build the Future of AI-Powered Ruby Apps Together<\/strong><\/h4>\n\n\n\n<p>LeoAndRuby is more than just a gem\u2014it\u2019s a step toward making generative AI accessible to the Ruby community. Whether you\u2019re a developer, a creator, or an AI enthusiast, I hope this gem inspires you to experiment, innovate, and create something amazing.<\/p>\n\n\n\n<p>Thank you for being part of this journey. I can\u2019t wait to see what you build with <strong>LeoAndRuby<\/strong>!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Ready to dive in?<\/strong> Install the gem and get started today! If you have any questions, comments, or ideas, feel free to reach out\u2014I\u2019d love to hear from you. \ud83d\ude0a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, I\u2019m thrilled to announce the launch of LeoAndRuby, a brand-new Ruby gem that makes it easier than ever to harness the power of AI for image generation. With just a few lines of code, developers can integrate cutting-edge image generation capabilities from the Leonardo.ai API into their Ruby applications. Whether you&#8217;re building a Rails&hellip; <br \/> <a class=\"read-more\" href=\"https:\/\/rhwbaldwin.com\/blog\/2024\/11\/21\/introducing-leoandruby-simplifying-ai-powered-image-generation-for-ruby-developers\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":110,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[7,13,14,15],"class_list":["post-108","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-ml-and-llms","category-developer-tools","tag-ai","tag-leonardo-ai","tag-ruby","tag-rubygem"],"_links":{"self":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":4,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions\/114"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/media\/110"}],"wp:attachment":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}