<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Simona Cotin</title>
    <description>The latest articles on DEV Community by Simona Cotin (@simona_cotin).</description>
    <link>https://dev.to/simona_cotin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F145199%2F37161835-0a62-460b-a349-d7907869cdc1.png</url>
      <title>DEV Community: Simona Cotin</title>
      <link>https://dev.to/simona_cotin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/simona_cotin"/>
    <language>en</language>
    <item>
      <title>Boosting your Serverless APIs with API Management at Create:Serverless</title>
      <dc:creator>Simona Cotin</dc:creator>
      <pubDate>Wed, 30 Sep 2020 05:51:14 +0000</pubDate>
      <link>https://dev.to/azure/boosting-your-serverless-apis-with-api-management-at-create-serverless-3h9o</link>
      <guid>https://dev.to/azure/boosting-your-serverless-apis-with-api-management-at-create-serverless-3h9o</guid>
      <description>&lt;h2&gt;
  
  
  Create:Serverless
&lt;/h2&gt;

&lt;p&gt;Join us for a half-day of conversations this 30 Sep 2020, at &lt;a href="https://aka.ms/createserverless"&gt;Microsoft Create: Serverless&lt;/a&gt; and connect with the experts and community members to discuss how you can run code for any application without having to manage servers.&lt;/p&gt;

&lt;p&gt;Sign up and add to your calendar: &lt;a href="https://aka.ms/createserverless"&gt;https://aka.ms/createserverless&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IuApkw7a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0mt8dtjyyjyt46u92neo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IuApkw7a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0mt8dtjyyjyt46u92neo.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Boosting your Serverless APIs with API Management
&lt;/h2&gt;

&lt;p&gt;Serverless provides powerful and scalable ways to write APIs for web, mobile, and microservices. By combining Azure Functions with API Management, you can add new features like generating functions from an API definition, managing endpoints with policies and security, and rich end to end monitoring.&lt;/p&gt;

&lt;p&gt;In this session, we'll dive into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Why would someone working with functions think about adding API Management?  What benefits does it provide?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What's the easiest way to get started with API Management and functions?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Show you how to get started with integrating Azure Functions and API Management&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Want to know more? Join Jeff Hollan and Mike Budzynski on Sep 30th, at 10:25 AM (PDT) to discuss about all the ways in which you can use API Management to enhance your APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  New to Serverless Concepts and Technologies? Start here:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/azure/azure-functions/?WT.mc_id=createserverless-docs-cxa"&gt;Read: Azure Functions Docs&lt;/a&gt; - to learn core concepts!&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/learn/paths/create-serverless-applications?WT.mc_id=createserverless-docs-cxa"&gt;Create: Serverless Applications&lt;/a&gt; - with this hands-on tutorial.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://channel9.msdn.com/Shows/POWERful-Devs/A-Deep-Dive-Into-POWERful-Serverless-Applications?WT.mc_id=servsept20-devto-wachegha"&gt;Watch: POWERful Serverless Applications&lt;/a&gt; - a no-code option.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Azure-Samples/Serverless-APIs"&gt;Serverless APIs in Azure Workshop&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Try &lt;a href="https://azure.microsoft.com/free/?WT.mc_id=createserverless-docs-cxa"&gt;Azure fro FREE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Code of Conduct
&lt;/h3&gt;

&lt;p&gt;You are expected to adhere to the &lt;a href="https://aka.ms/createserverless"&gt;Create:Serverless's code of conduct&lt;/a&gt; as well as &lt;a href="https://dev.to/code-of-conduct"&gt;Dev.to's code of conduct&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag__tag ltag__tag__id__60537"&gt;
  
    .ltag__tag__id__60537 .follow-action-button{
      background-color:  !important;
      color:  !important;
      border-color:  !important;
    }
  
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="/t/mscreate" class="ltag__tag__link"&gt;mscreate&lt;/a&gt; 
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Want to keep track of these events and conversations? Follow the #mscreate tag above or follow &lt;a href="https://twitter.com/MicrosoftCreate"&gt;@MicrosoftCreate&lt;/a&gt; on Twitter.&lt;/p&gt;

</description>
      <category>mscreate</category>
      <category>azure</category>
      <category>serverless</category>
      <category>ama</category>
    </item>
    <item>
      <title>GraphQL and Serverless walk into a bar. A recipe to infinitely scale APIs</title>
      <dc:creator>Simona Cotin</dc:creator>
      <pubDate>Tue, 22 Sep 2020 09:20:16 +0000</pubDate>
      <link>https://dev.to/azure/graphql-and-serverless-walk-into-a-bar-a-recipe-to-infinitely-scale-apis-1gcm</link>
      <guid>https://dev.to/azure/graphql-and-serverless-walk-into-a-bar-a-recipe-to-infinitely-scale-apis-1gcm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;For a deep dive into building Serverless APIs using Hasura GraphQL join us at &lt;a href="https://aka.ms/createserverless"&gt;Create:Serverless&lt;/a&gt;. Allison and Burke will discuss how you can bring together your data sources into a unified GraphQL API with the Hasura GraphQL Engine &amp;amp; Azure Functions. &lt;/p&gt;

&lt;p&gt;Sessions at Create:Serverless will be FREE to attend and I'm excited to be your host during the day :)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What do GraphQL and Serverless have in common?
&lt;/h2&gt;

&lt;p&gt;They might seem unrelated, but in fact, both of them are very popular at the moment and have a similar trending pattern. While you're reading this article, I'm confident someone is open sourcing a new library either for Serverless or for GraphQL - awesomesauce, maybe for both - that will enable us to build amazing products more easily. The hype train, that's one thing that they have in common 🚂!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iA_7ZDD0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tol9fb3koa7cmio9dwcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iA_7ZDD0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tol9fb3koa7cmio9dwcy.png" alt="GraphQL vs Serverless - Search Term trends over the past five years"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Serverless and GraphQL have seen a massive adoption with Javascript developers.
&lt;/h3&gt;

&lt;p&gt;With GraphQL, frontend developers can intentionally move fast in building applications. With few exceptions, the back and forth and dependencies between backend and frontend teams are eliminated by the easiness of sharing data between the two. With &lt;a href="https://docs.microsoft.com/learn/modules/create-serverless-logic-with-azure-functions/?WT.mc_id=createserverless-docs-cxa"&gt;Serverless&lt;/a&gt;, it's become a LOT easier to extend our frontend skills and build APIs without acquiring expertise in provisioning and managing servers. &lt;/p&gt;

&lt;p&gt;Both of them have emerged around the same timeline, marking the dawn of a new era in developer productivity and tools.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Why GraphQL
&lt;/h3&gt;

&lt;p&gt;GraphQL is a query language for your API and a runtime to execute those queries on your existing data. It was developed by Facebook in 2012 when they started rewriting their mobile applications to native clients. The initial goal was to define a data fetching API powerful enough to describe all of Facebook. They ended up creating a Javascript reference implementation and open sourcing a &lt;a href="https://github.com/graphql/graphql-spec/releases/tag/July2015"&gt;spec&lt;/a&gt; that help address a few very important challenges when building APIs: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Overfetching data - retrieving data that we don't need&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Traditionally, to help solve this problem, we create a new endpoint that returns only the data we need or update an existing endpoint and include the required data. Whereas that can be compelling, and that's something that most of the teams do, it adds complexity to our code. We'll now have to process the response and filter out the data that we don't need on the client-side. On top of that, we have a leaking abstraction - there's now a strong coupling between our backend and frontend that reflects our client code's data needs. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Underfetching data - also known as a chatty API, when our APIs force clients to make multiple requests to perform a single operation&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You might be familiar with the n+1 problem - when a request to one item turns into n+1 requests since it has n associated items. The roundtrips to the server consume valuable user data and time.&lt;/p&gt;

&lt;p&gt;One of the reasons we need to think about overfetching and underfetching is that both directly impact our user's experience. Having to process data on the client-side and making multiple roundtrips to the server incurs a delay on our client apps, which in turn has a direct impact on the user perception:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RyzWNnlz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ag5w25gizebo67558gx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RyzWNnlz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ag5w25gizebo67558gx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;API proliferation and lack of up to date documentation&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first two challenges lead to a high number of poorly documented and maintained endpoints that are tightly coupled to our client apps. &lt;/p&gt;

&lt;p&gt;With GraphQL queries, clients only retrieve the data they need - they control the size &amp;amp; shape of the data that the API returns. Developers have access access to a single API endpoint with realtime documentation for available operations that can be run against the API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Serverless
&lt;/h3&gt;

&lt;p&gt;Serverless enables us to run code in reaction to events, without having to worry about managing their runtime. The &lt;a href="https://docs.microsoft.com/azure/azure-functions/functions-scale?WT.mc_id=createserverless-devto-cxa"&gt;platform provider&lt;/a&gt; will automatically scale up and down the number of resources needed to meet the current workload while maintaining reliable performance for our users. One of the most &lt;a href="https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview#serverless-use-cases"&gt;common uses cases&lt;/a&gt; for serverless is building web APIs for frontend and mobile applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the benefits of using Serverless and GraphQL together?
&lt;/h3&gt;

&lt;p&gt;Serverless and GraphQL like any other strong symbiosis relationship complement one another beautifully.&lt;/p&gt;

&lt;p&gt;With Serverless we get easy integration of different data sources, while with GraphQL we can easily unify multiple data sources together.&lt;/p&gt;

&lt;p&gt;With Serverless, we get autoscalability out of the box, and with GraphQL, we get a single endpoint that will allow us to query multiple data sources. &lt;/p&gt;

&lt;p&gt;With Serverless, we end up writing less code focusing on the problems we're solving for, and with GraphQL, we make a smaller number of requests optimizing for user performance.&lt;/p&gt;




&lt;h3&gt;
  
  
  With Serverless and GraphQL, we can achieve more by doing less.
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Want to do more with Serverless?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Join us at &lt;a href="https://aka.ms/createserverless"&gt;CREATE:Serverless&lt;/a&gt; on Sep 30 (8:00am PDT / 12:30am EDT) for a 4-hr free virtual event with 8 sessions and a &lt;a href="https://aka.ms/createserverless"&gt;50-minute hands-on workshop&lt;/a&gt; to jumpstart your serverless journey&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Bookmark &lt;a href="https://dev.to/azure/microsoft-create-serverless-conversations-with-community-and-industry-experts-2kn8"&gt;our anchor post&lt;/a&gt; and do check back for updates&lt;/p&gt;
&lt;/blockquote&gt;




</description>
      <category>serverless</category>
      <category>graphql</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A Deep Dive into POWERful Serverless Application </title>
      <dc:creator>Simona Cotin</dc:creator>
      <pubDate>Thu, 09 Jul 2020 17:57:15 +0000</pubDate>
      <link>https://dev.to/azure/a-deep-dive-into-powerful-serverless-application-34bi</link>
      <guid>https://dev.to/azure/a-deep-dive-into-powerful-serverless-application-34bi</guid>
      <description> 
&lt;h4&gt;
  
  
  #PowerfulDevs Conference
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;RSVP HERE BY JULY 15:&lt;/code&gt; &lt;br&gt;
&lt;a href="https://aka.ms/powerfuldevsconf" rel="noopener noreferrer"&gt;https://aka.ms/powerfuldevsconf&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The &lt;a href="https://aka.ms/powerfuldevsconf" rel="noopener noreferrer"&gt;Powerful DEVs Conference&lt;/a&gt; is the first virtual conference of its kind. We will showcase how developers can leverage the Power Platform to build applications faster and with far less effort. Connect with industry-recognized ProDev influencers, Microsoft Cloud Advocates, trusted and diverse community leaders, and members of the Power Platform Team. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;BOOKMARK THIS FOR RESOURCES AND DISCUSSION WITH SPEAKERS&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/azure" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__org__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F512%2F64ce0b82-730d-4ca0-8359-2c21513a0063.jpg" alt="Microsoft Azure"&gt;
      &lt;div class="ltag__link__user__pic"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F422403%2F5e52a938-ac03-4919-afca-d684c4a3e39a.jpg" alt=""&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/azure/powerfuldevs-conference-join-us-on-july-15th-online-fe3" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;#powerfuldevs Conference: Join us on July 15th Online!&lt;/h2&gt;
      &lt;h3&gt;JennyMEvents for Microsoft Azure ・ Jul 10 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#powerfuldevs&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#powerplatform&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#prodev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;
 

&lt;p&gt;Revisit this page during the event to engage in live (and post-event) discussions on those topics with both speakers and community. The speakers will be here for a live Q&amp;amp;A for at least 30 minutes immediately after their session concludes. After the event, come back to find additional slides, videos, and resources for this session. &lt;/p&gt;


 

&lt;h2&gt;
  
  
  About This Session:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;July 15, 2020: 09:30 PDT – 09:55 PDT&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Far from being the latest 'tech trend', serverless applications help your organization scale quickly and efficiently. They take the hassle out of provisioning infrastructure, configuring web servers, debugging configuration, and managing security settings, allowing your team to focus on coding and testing. The one aspect where serverless functions fall short is when it comes to state management. When missing state management abilities, building up complex flows in your data processing will prove to be quite daunting, and often, will require you to provide custom mechanisms for enabling you to communicate between your functions. Join this session to learn how to build serverless applications that scale seamlessly and automatically and leverage the Power Platform to create reliable and low-code applications.   &lt;/p&gt;

&lt;p&gt;Additional Resources: &lt;a href="https://25daysofserverless.com/" rel="noopener noreferrer"&gt;25 Day of Serverless&lt;/a&gt; &lt;br&gt;
&lt;a href="https://aka.ms/learn-serverless" rel="noopener noreferrer"&gt;Learn Serverless&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aka.ms/PowerServerless" rel="noopener noreferrer"&gt;Intro to Azure Functions&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Speakers:
&lt;/h2&gt;

&lt;p&gt;Simona Cotin is a Cloud Advocate @ Microsoft and the ServerlessDays Co-organizer. Follow &lt;a href="https://twitter.com/simona_cotin" rel="noopener noreferrer"&gt;@simona_cotin&lt;/a&gt; on Twitter. &lt;/p&gt;

</description>
      <category>ama</category>
      <category>powerfuldevs</category>
      <category>azure</category>
      <category>powerplatform</category>
    </item>
    <item>
      <title>Build your jokes generator using Machine Learning and Serverless</title>
      <dc:creator>Simona Cotin</dc:creator>
      <pubDate>Sat, 14 Dec 2019 12:33:50 +0000</pubDate>
      <link>https://dev.to/azure/build-your-jokes-generator-using-machine-learning-and-serverless-5g4a</link>
      <guid>https://dev.to/azure/build-your-jokes-generator-using-machine-learning-and-serverless-5g4a</guid>
      <description>&lt;p&gt;This article is part of &lt;a href="https://25daysofserverless.com"&gt;#25DaysOfServerless&lt;/a&gt;. New challenges will be published every day from Microsoft Cloud Advocates throughout the month of December. Find out more about how Microsoft Azure enables your &lt;a href="https://docs.microsoft.com/azure/azure-functions/?WT.mc_id=25days_devto-blog-cxa"&gt;Serverless functions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Have an idea or a solution? &lt;a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=I'm%20joining%20the%20@azureadvocates%20%2325DaysOfServerless%20challenge!!%20Learn%20more%20at%20https://aka.ms/25daysofserverless%20or%20see%20solutions%20at%20https://dev.to/search?q=25DaysOfServerless!%20Join%20me!"&gt; Share your thoughts on Twitter! &lt;br&gt;
&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;The Turing test has been the de facto standard for testing a machine for intelligence. It's the way we try to figure out if our models are capable of responding to general-purpose questions the way a human would. The most efficient method for building a machine that has human-like responses is using neural networks and deep learning. These are new algorithms that have been made feasible through the recent advancements in hardware performance.&lt;/p&gt;

&lt;p&gt;One aspect of humanity that is restricted to evolved primates is humor. In all fairness, there is no clear cut definition of humor, however, there is one theory that has gained quite a bit of popularity in recent years. The argument is that what makes us classify something as being funny falls under the "incongruity theory". The underlying mechanism of this theory builds on top of the inconsistency between what we are expecting to happen and what actually happens.&lt;br&gt;
As it turns out the cognitive mechanisms that allow us to identify something as "funny" are quite complex, and it is only a few evolved primates that can find something funny.&lt;br&gt;
For example Koko, the western lowland gorilla who understands more than 1,000 American Sign Language signs and 2,000 spoken words has been observed making prank jokes (IE: she would tie the instructor's shoelaces and then innocently make the sign for "chase". That's one tricksy gorilla :D !).&lt;br&gt;
As a rule of thumb, the primates that can make laughing like sounds and are ticklish can be categorized as having a sense of humor.&lt;/p&gt;

&lt;p&gt;Computers, on the other hand, are not ticklish, vocal cords are not yet a justified upgrade on any of the latest generation laptops, so, by all means, training a machine to understand humor needs to be trained by other means. The best way to train a neural network is by using an exhaustive text that contains as many jokes as possible in a specific format. You will notice that we already restricted the domain of humor to jokes (no pranks, ironic comedy with complex situations etc).&lt;/p&gt;

&lt;p&gt;"If you're willing to restrict the flexibility of your approach, you can almost always do something better."&lt;br&gt;
– John Carmack"&lt;/p&gt;

&lt;p&gt;In our situation, we want to restrict the domain of the jokes to one-liners, question style comedy which would make the training of our model more focused, essentially what we are doing is gently nudging the machine in the right direction.&lt;br&gt;
The machine intelligence we are building is for text generation, a deep learning neural network that can make jokes.&lt;br&gt;
We will use the language with the most evolved ecosystem in terms of libraries, examples, and documentation, which in this case, is Python. I am a big fan of Python for its readability and because it is very closely evolving alongside JavaScript so many things feel familiar, it's also the other serverless language, and this makes it an excellent candidate to&lt;br&gt;
write an &lt;a href="https://docs.microsoft.com/en-gb/azure/azure-functions/functions-reference-python?WT.mc_id=25daysofserverless-github-cxa"&gt;Azure Function&lt;/a&gt; that tells us jokes.&lt;br&gt;
The most popular approach to writing text generation applications are based on Andrej Karpathy's &lt;a href="https://github.com/karpathy/char-rnn"&gt;char-rnn architecture&lt;/a&gt; and &lt;a href="https://karpathy.github.io/2015/05/21/rnn-effectiveness/"&gt;blog post&lt;/a&gt;,&lt;br&gt;
the example teaches a recurrent neural network to predict the next character in a sequence based on the previous n characters.&lt;br&gt;
Based on Andrejs work &lt;a href="https://minimaxir.com"&gt;Max Woolf&lt;/a&gt; built a &lt;a href="https://github.com/minimaxir/textgenrnn"&gt;python package&lt;/a&gt; that makes building a text generation bot very easy. It allows you to configure your neural network depth/layers/behavior etc.&lt;/p&gt;

&lt;p&gt;The main method for training your joke model is textgenrnn. This object has a train_from_file method that allows you to consume a file with training data to teach your bot to figure out what punch line would be best suited to answer the joke.&lt;/p&gt;

&lt;p&gt;The usage is quite straightforward, training a simple model would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;textgenrnn&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;textgenrnn&lt;/span&gt;

&lt;span class="n"&gt;textgen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;textgenrnn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"new_model"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;textgen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;train_from_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'jokes.txt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num_epochs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After we have trained the data from the training data set, let's take it for a spin and try generating a test joke. We can do this by calling textgen.generate(). This will output the joke, but this simple call will not return the joke from the serverless function, which means we want to use a version of the method call that returns the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;joke&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;textgen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;return_as_list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;# Grab the first generated joke in the list, in this case the only one
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The script will create the model that is a serialized version of the dataset that will be used by tensorflow to help our function generate jokes based on the training data. This is the file with .hdf5 extension in your project's root folder.&lt;/p&gt;

&lt;p&gt;Now the last piece of the puzzle is using the new model as a trigger to generate jokes in an Azure Function. Assuming you created a storage account that has a container named jokes, here's how your function will look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;azure.functions&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;textgenrnn&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;textgenrnn&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;tempfile&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;urllib.request&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;logging&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myblob&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InputStream&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;tempFilePath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tempfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gettempdir&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;jokesfile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tempFilePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"jokes.hdf5"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;urlretrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myblob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;jokesfile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;textgen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;textgenrnn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jokesfile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;joke&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;textgen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;return_as_list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;f"joke: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;joke&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "jokes/{name}",
      "connection": "AzureWebJobsStorage"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To test your function, upload the generated .hdf5 file to the joke container and see the generated joke in the functions logs. &lt;/p&gt;

&lt;p&gt;Need more inspiration? You can find the source code in my github repository &lt;a href="https://github.com/simonaco/25daysofserverless"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Congrats
&lt;/h4&gt;

&lt;p&gt;You now have an API with a sense of humor :D&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusions
&lt;/h4&gt;

&lt;p&gt;You can notice that the API is not particularly funny in the classical sense, but it will surprise you. I think that what you would be expecting and what the endpoint is returning will definitely fall under the "theory of incongruity".&lt;/p&gt;

&lt;p&gt;To improve results to match more traditional patterns, there are a few ways to improve the training method like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;restrict the type of jokes&lt;/li&gt;
&lt;li&gt;increase training data set size&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Want to submit your solution to this challenge? Build a solution locally and then &lt;a href="https://github.com/microsoft/25-days-of-serverless/issues/new?assignees=&amp;amp;labels=challenge-submission&amp;amp;template=challenge-solution-submission.md&amp;amp;title=%5BCHALLENGE+SUBMISSION%5D+"&gt;submit an issue&lt;/a&gt;. If your solution doesn't involve code you can record a short video and submit it as a link in the issue desccription. Make sure to tell us which challenge the solution is for. We're excited to see what you build! Do you have comments or questions? Add them to the comments area below.&lt;/p&gt;




&lt;p&gt;Watch for surprises all during December as we celebrate 25 Days of Serverless. Stay tuned here on dev.to as we feature challenges and solutions! Sign up for a &lt;a href="https://azure.microsoft.com/free/?WT.mc_id=25days_devto-blog-cxa"&gt;free account on Azure&lt;/a&gt; to get ready for the challenges!&lt;/p&gt;

</description>
      <category>25daysofserverless</category>
      <category>serverless</category>
      <category>azure</category>
      <category>python</category>
    </item>
  </channel>
</rss>
