<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dinithi Dissanayake on Medium]]></title>
        <description><![CDATA[Stories by Dinithi Dissanayake on Medium]]></description>
        <link>https://medium.com/@dmdinithipurna?source=rss-32501cf3cafb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d9QC5z2KveAB3fXL1IbCAw.png</url>
            <title>Stories by Dinithi Dissanayake on Medium</title>
            <link>https://medium.com/@dmdinithipurna?source=rss-32501cf3cafb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:23:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dmdinithipurna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Quaternions]]></title>
            <link>https://medium.com/@dmdinithipurna/understanding-quaternions-67cf263c276f?source=rss-32501cf3cafb------2</link>
            <guid isPermaLink="false">https://medium.com/p/67cf263c276f</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[quaternion]]></category>
            <dc:creator><![CDATA[Dinithi Dissanayake]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 13:57:32 GMT</pubDate>
            <atom:updated>2025-09-23T13:57:32.482Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently started working on a large VR dataset, which stores data in quaternions (Unity’s primary unit for storing directions). Therefore, I thought of writing this article to help most of you understand what this unit, called a quaternion, represents! (Mostly because it took a handful of my time to understand this!!! Also, I am new to Unity!)</p><p><strong>Euler Angles</strong></p><p>Euler angles are a method for representing the orientation of an object in three-dimensional space using a set of three angles. These angles describe rotations around the object’s principal axes, typically denoted as roll, pitch, and yaw. Here’s what each angle represents:</p><ol><li>Roll (φ): The roll angle represents the rotation around the object’s X-axis. Imagine holding an object and tilting it side to side. The roll angle measures this rotation.</li><li>Pitch (θ): The pitch angle represents the rotation around the object’s Y-axis. Visualise holding an object and tilting it forward or backwards. The pitch angle measures this rotation.</li><li>Yaw (ψ): The yaw angle represents the rotation around the object’s Z-axis. Picture turning an object to face a different direction while keeping it upright. The yaw angle measures this rotation.</li></ol><p>To understand this easily, let’s try rotating our head:)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYIjaGsqG1CCv59m1oFLAA.png" /></figure><p>Quaternions can feel tricky at first, but the main reason we even need them is because <strong>yaw, pitch, and roll (Euler angles) don’t always work well</strong>. The problem is called <strong>gimbal lock, </strong>which happens when two rotation axes line up and start moving together. At that point, you lose one degree of freedom and can’t represent all rotations correctly.</p><p>To really see how this happens, I recommend watching a short video demonstration, which makes the gimbal lock problem much easier to understand: <a href="https://youtu.be/zc8b2Jo7mno?si=VMs_2Q0xFoo3Op-F">https://youtu.be/zc8b2Jo7mno?si=VMs_2Q0xFoo3Op-F</a></p><p>At first glance, quaternions can look intimidating; after all, instead of three numbers (yaw, pitch, roll), they use <strong>four numbers</strong>. But the reason for this extra number is that quaternions represent rotations in a way that’s smooth, stable, and free from gimbal lock.</p><p>Think of a quaternion as a clever way of storing a rotation that avoids the axis-overlap problem we saw earlier. Unity and most VR systems rely on quaternions under the hood, even if they let us work with Euler angles on the surface.</p><p>A quaternion is written as:</p><p>q = w + xi + yj + zk</p><p>Or more simply:</p><p>q=(w,x,y,z)</p><ul><li><strong>(x, y, z)</strong> → the axis of rotation (a vector pointing in the direction of the axis).</li><li><strong>w</strong> → related to the angle of rotation.</li></ul><p>They are connected by:</p><ul><li>w=cos⁡(θ/2)</li><li>(x,y,z)=axis × sin⁡(θ/2)</li></ul><p>where <strong>θ</strong> is the angle you want to rotate.</p><p>So if you pick an axis (say, “spin around the Y-axis”) and an angle (say, 90°), you can compute the quaternion directly.</p><ul><li>θ = π/2 radians</li><li>axis = (0, 1, 0) (unit vector along Y)</li><li>w = cos(π/4) = √2/2 ≈ 0.707</li><li>(x, y, z) = (0, 1, 0) × sin(π/4) = (0, √2/2, 0)</li><li>So q = (√2/2, 0, √2/2, 0)</li></ul><p><strong>You don’t need to memorize quaternion math to use them effectively</strong>. Instead, think of them as a safe and reliable way for computers to handle rotations, while you focus on building your application or experiment.</p><p>The only time you’ll really need the equations is when you’re working with <strong>raw quaternion data</strong> (for example, exporting from Unity or a VR headset). In those cases, understanding how to convert quaternions back into Euler angles or axis–angle form will help you <strong>clean the data into a more human-readable format</strong>.</p><p>Hope this helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67cf263c276f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Science Research]]></title>
            <link>https://medium.com/@dmdinithipurna/design-science-research-43c55d36e583?source=rss-32501cf3cafb------2</link>
            <guid isPermaLink="false">https://medium.com/p/43c55d36e583</guid>
            <dc:creator><![CDATA[Dinithi Dissanayake]]></dc:creator>
            <pubDate>Fri, 19 Jan 2024 14:12:47 GMT</pubDate>
            <atom:updated>2024-01-19T14:14:36.761Z</atom:updated>
            <content:encoded><![CDATA[<h3>Design Science Research: A Simple Introduction</h3><p>I am heavily a CS person who predominantly worked with point clouds(in simple words “3D computer vision” — — simpler “machine learning”). I wanted to do something more practical and closer to human needs; I chose to do a PhD in Information Systems and Analytics! Do you think it is a good idea? I seem lost most of the time, but let’s see. From this article, I will introduce the umbrella term Design Science Research (DSR) in Information Systems(IS) where most of the things I have in mind to do for my PhD, combining both ML and HCI fit into.</p><p>There is a whole set of publications we can refer to when entering the DSR field in IS to understand the methodologies, but it would take a lot of work to grasp everything at once at first. Therefore, I will explain some contexts I figured out when running through some design science methodology papers.</p><p>According to <em>Hevner(2007</em>), three cycles need to be present in any design science research, namely, the Relevance cycle, Design cycle, and Rigor cycle. These three cycles must not only be present but also should be identifiable in a DSR project. In a nutshell, the three cycles mean the following:</p><ol><li>Relevance cycle: Mainly will provide the requirements of the research and point out what criteria can be used to evaluate the results of the research.</li><li>Rigor cycle: IS research is normally associated with a kernel theory. The rigor cycle will provide the past knowledge base (already existing theories and processes) to make sure that the project is innovative. there should be some new contribution to the existing theory!</li><li>Design cycle: This is a reiterative process where the researcher will generate a set of alternatives and compare one with another until all the design requirements are satisfied. This cycle is dependent on both the Relevance and rigor cycles making the whole DSR process an iterative one.</li></ol><p>DSR seems very practical, but then again one should ensure that its resulting artifacts are scientifically important as well.</p><p>In their paper,<em> Peffers et al(2007)</em> pointed out a practical diagram of the DSR process. Let me reuse the same case study they used to simply explain the DSR process.</p><p>Case study: requirements engineering for a system for self-service and design of newspaper display advertising(Helsingin Sanomat) for a wide audience of users. The process contains 7 major steps and the below image depicts how this system design went through them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pfyJ49Qy8fB6NFf4P0UHg.png" /><figcaption>DSR process case study | Reference: Peffers et al(2007)</figcaption></figure><p>Through this process, we can identify that we can enter the DSR process from four possible sections.</p><ol><li>Problem identification &amp; motivation: By defining a research problem and seeing the value of having a solution to that problem</li><li>Objectives of a solution: try and infer the objectives of a solution from the problem itself. ex- what would a better artifact accomplish</li><li>Design and development: determine the functioning requirements of the artifact and create the artifact.</li><li>Demonstration: present how well the particular artifact solves the requirement.</li></ol><p>One can easily see the presence of the three cycles of relevance, rigor, and design in the above case study! If you see this case study it is exactly a design engineering lifecycle, so what’s so IS or research suitability about it? I believe the communication is the most important part. With the publications the designers and the researcher have got together and identified some design requirements and guidelines, creating a framework that can be easily adaptable by system engineers to design similar or relatable systems. Also, the design artifacts are mostly generalizable to any system that is trying to attract a wide audience of end users.</p><p>Another interesting read would be <em>Gregor et al(2013) </em>to see how you can position your design science research to have a maximum impact. As they point out you might face the following problems when communicating your DSR project.</p><ol><li>How can we differentiate or identify new design principles within a collection of routine and mundane principles and will reviewers see them as design principles worthy of demonstrating?</li><li>Novelty: are there any new contributions to the theories? has this gone through a rigorous evaluation? : Is this new knowledge?</li><li>Can we effectively communicate our research through the journal paper confinements?</li></ol><p>Let’s try to keep these in mind when going through the phases of the DSR process. Once again this can be an exact repetition of the two papers of Hevner and Peffers, but I hope this will be valuable to have a simple and concise view of what DSR means before dwelling much deeper into its concepts.</p><p><strong><em>References</em></strong></p><p>Hevner, A. R. (2007). A three cycle view of design science research. <em>Scandinavian journal of information systems</em>, <em>19</em>(2), 4.</p><p>Peffers, K., Tuunanen, T., Rothenberger, M. A., &amp; Chatterjee, S. (2007). A design science research methodology for information systems research. <em>Journal of management information systems</em>, <em>24</em>(3), 45–77.</p><p>Gregor, S., &amp; Hevner, A. R. (2013). Positioning and presenting design science research for maximum impact. <em>MIS quarterly</em>, 337–355.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43c55d36e583" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swagger UI to your Python Flask API]]></title>
            <link>https://medium.com/the-ai-analytics-corner/swagger-ui-to-your-python-flask-api-9bf1c8fc0178?source=rss-32501cf3cafb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf1c8fc0178</guid>
            <category><![CDATA[flask-api]]></category>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai-applications]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dinithi Dissanayake]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 03:06:01 GMT</pubDate>
            <atom:updated>2023-07-10T03:06:01.095Z</atom:updated>
            <content:encoded><![CDATA[<h4>Adding a visual sensation to your ML Flask application</h4><p>Flask is the go-to library for API development in Python, mostly because of its light weight and already implemented development server and debugging tool. Swagger in the other hand is a set of tools helping API developers tackle its lifecycle. Among its suite of tools, Swagger-UI gives us an interactive web UI to test the created API, similar to what we do using Postman. Some of the API gateways use the capabilities of the swagger UI to give a visual sensation of the created API to the users.</p><p>Unlike spring boot swagger UI generators there is no easy way of generating swaggers for flask-based python APIs. I have put together the use of the library <strong>flasgger </strong>to build an interactive UI for your flask application.</p><p>Let’s first create a simple flask API.</p><p><strong>Flask API for Wine Quality Prediction</strong></p><p>I have trained a simple regression model which predicts the quality of a wine when given the following features,</p><ol><li>fixed acidity</li><li>volatile acidity</li><li>citric acid</li><li>residual sugar</li><li>chlorides</li><li>free sulfur dioxide</li><li>total sulfur dioxide</li><li>density</li><li>pH</li><li>sulphates</li><li>alcohol</li></ol><p>The dataset was obtained from<a href="https://www.kaggle.com/datasets/uciml/red-wine-quality-cortez-et-al-2009"> https://www.kaggle.com/datasets/uciml/red-wine-quality-cortez-et-al-2009</a>.</p><p>Let’s create a simple API to input these parameters and receive the wine quality as the output.</p><pre>from flask import Flask, render_template, Response, jsonify, request<br>import flask <br>from flask import Flask, request, jsonify<br>from flask import Blueprint<br>from flasgger import Swagger, LazyString, LazyJSONEncoder<br>from flasgger import swag_from<br>import joblib<br>import sklearn<br>import numpy as np<br>import json<br><br>app = Flask(__name__)<br>app.json_encoder = LazyJSONEncoder<br><br>model= joblib.load(&#39;wqmodel.sav&#39;)<br>        <br>#################################################################################################################################################################################<br>@app.route(&quot;/predict&quot;,methods = [&quot;POST&quot;]) <br>def predict():<br>    data = {} # dictionary to store result <br>    data[&#39;code&#39;] = 1<br>    data_n = request.get_json()<br>    if request.method == &quot;POST&quot;:<br>        try:<br>            array= np.array(data_n[&quot;array&quot;])<br>            <br>        #for invalid data keys<br>        except KeyError:<br>            return jsonify({&quot;responseCode&quot;: &quot;2&quot;,&quot;responseDesc&quot;: &quot;Invalid data Key&quot;}), 400<br>        <br>        #if the input is empty                    <br>        if array is None:<br>            print(&quot;Array Input Failed..&quot;)<br>            data[&#39;response&#39;] = &#39;Input Reading Error: Input is Empty&#39;<br>            return jsonify({&quot;responseCode&quot;: &quot;3&quot;,&quot;responseDesc&quot;: &quot;Input Reading Error: Input is Empty&quot;}), 400<br>        <br>        #if the input array is not the required size<br>        elif len(array)!=11:<br>            print(&quot;Array Input InComplete..&quot;)<br>            data[&#39;response&#39;] = &#39;Input Reading Error: Input is Incomplete&#39;<br>            return jsonify({&quot;responseCode&quot;: &quot;3&quot;,&quot;responseDesc&quot;: &quot;Input Reading Error: Input is Incomplete&quot;}), 400 <br><br>        else:<br>            array=array.reshape(1,11)<br>            #prediction<br>            prediction = model.predict(array)<br>            data[&#39;code&#39;] = 0<br>            data[&#39;response&#39;] = &#39;Model prediction PASSED&#39;<br>            data[&#39;prediction&#39;] = prediction<br>            response={&quot;responseCode&quot;: &quot;0&quot;,&quot;responseDesc&quot;: &quot;SUCCESS&quot;,&quot;Wine Quality&quot;: prediction[0]}       <br>            return jsonify(response),200<br>               <br>    else:<br>        return jsonify({&quot;responseCode&quot;: &quot;1&quot;,&quot;responseDesc&quot;: &quot;Method Not Allowed&quot;}), 405<br><br>if __name__ == &#39;__main__&#39;:<br>    print((&quot;* Loading model and Flask starting server...&quot;<br>                &quot;please wait until server has fully started&quot;)) <br>    app.run(host=&#39;0.0.0.0&#39;, threaded=True, port=8085 , debug=False)</pre><p>I have trained a simple Elastic Net model to predict the wine quality and when this app receives the following POST request it will give the wine quality prediction as depicted below.</p><pre>curl --location &#39;http://localhost:5000/predict&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--data &#39;{<br>    &quot;array&quot;: [7, 0.27, 0.36, 20.7, 0.045, 45, 170, 1.001, 3, 0.45, 6]<br>}&#39;</pre><pre>{<br>    &quot;Wine Quality&quot;: 4.939022628389594,<br>    &quot;responseCode&quot;: &quot;0&quot;,<br>    &quot;responseDesc&quot;: &quot;SUCCESS&quot;<br>}</pre><p>You can easily check the functioning with the aid of any API platform like Postman. Now I will show how you can create a swagger UI for inbuilt testing of this flask API without the need of any external platform.</p><p><strong>Building the swagger UI</strong></p><p>When using flasgger we should add the API specification as yaml either in the same python script or using an externel yaml file. I have used a separate yaml file since it is easy to debug and does not clutter the API file.</p><p>The separate yaml file(located at ../docs/predict.yaml) is as follows.</p><pre>description: &quot;This API will be used to predict the class of the uploaded image&quot;<br>tags:<br>  - name: Predict the Wine Quality<br>consumes:<br>  - application/json<br>produces:<br>  - application/json<br>parameters:<br>  - description: &quot;The body should contain the array containing the 11 input parameters in the order of: <br>  fixed acidity, volatile acidity, citric acid, residual sugar, chlorides, free sulfur dioxide, total sulfur dioxide, <br>  density, ph, sulphates, alcohol&quot;<br>    in: &quot;body&quot;<br>    name: &quot;body&quot;<br>    schema:<br>      title: predict<br>      type: object<br>      properties:<br>        array:<br>          type: array<br>          description: Input Array<br>      example:<br>        array : [7, 0.27, 0.36, 20.7, 0.045, 45, 170, 1.001, 3, 0.45, 6]<br>    required: true<br>responses:<br>    &quot;200&quot;:<br>      description: Successful response<br>      schema:<br>        title: Valid Prediction Response<br>        type: object<br>        example:<br>          Wine Quality: 4.939022628389594<br>          responseCode: 0<br>          responseDesc: SUCCESS<br>    &quot;400&quot;:<br>      description: Bad request<br>      schema:<br>        title: Invalid data Key<br>        type: object<br>        example:<br>          responseCode: 2<br>          responseDesc: Invalid data Key<br>    &quot;401&quot;:<br>      description: Bad request<br>      schema:<br>        title: Input is not an array of size 11<br>        type: object<br>        example:<br>          responseCode: 3<br>          responseDesc: &quot;Input Reading Error: Input is Incomplete&quot;<br>  <br>    &quot;405&quot;:<br>      description: Method Not Allowed<br>      schema:<br>        title: Method Not Allowed<br>        type: object<br>        example:<br>          responseCode: 1<br>          responseDesc: Method Not Allowed</pre><p>You should create a yaml file for each of the endpoints(routes) in your API, including what the endpoint consumes and produces. You can include examples so that the swagger UI will give you the chance to try it out. More descriptive you are in creating the yaml file, more appealing and descriptive your UI will be.</p><p>After creating your yaml file your python script should include additional swagger configurations. I will give you a basic example, so that you can edit the information to suit your need.</p><pre>from flask import Flask, render_template, Response, jsonify, request<br>import flask <br>from flask import Flask, request, jsonify<br>from flask import Blueprint<br>from flasgger import Swagger, LazyString, LazyJSONEncoder<br>from flasgger import swag_from<br>import joblib<br>import sklearn<br>import numpy as np<br>import json<br><br>app = Flask(__name__)<br>app.json_encoder = LazyJSONEncoder<br><br>swagger_template ={<br>    &quot;swagger&quot;: &quot;2.0&quot;,<br>    &quot;info&quot;: {<br>      &quot;title&quot;: &quot;Wine Quality Prediction&quot;,<br>      &quot;description&quot;: &quot;API Documentation for Wine Quality Prediction&quot;,<br>      &quot;contact&quot;: {<br>        &quot;name&quot;: &quot;Admin&quot;,<br>        &quot;email&quot;: &quot;dinithi@axiatadigitallabs.com&quot;,<br>        &quot;url&quot;: &quot;http://www.axiatadigitallabs.com&quot;,<br>        },<br>      &quot;termsOfService&quot;: &quot;Terms of services&quot;,<br>      &quot;version&quot;: &quot;1.0&quot;,<br>      &quot;host&quot;:&quot;Wine_Quality_Prediction&quot;,<br>      &quot;basePath&quot;:&quot;http://localhost:5000&quot;,<br>      &quot;license&quot;:{<br>        &quot;name&quot;:&quot;License of API&quot;,<br>        &quot;url&quot;:&quot;API license URL&quot;<br>      }<br>              },<br>    &quot;schemes&quot;: [<br>        &quot;http&quot;,<br>        &quot;https&quot;<br>    ],<br>      }<br><br>swagger_config = {<br>    &quot;headers&quot;: [<br>        (&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;),<br>        (&#39;Access-Control-Allow-Methods&#39;, &quot;GET, POST&quot;),<br>    ],<br>    &quot;specs&quot;: [<br>        {<br>            &quot;endpoint&quot;: &#39;Wine_Quality_Prediction&#39;,<br>            &quot;route&quot;: &#39;/Wine_Quality_Prediction.json&#39;,<br>            &quot;rule_filter&quot;: lambda rule: True,<br>            &quot;model_filter&quot;: lambda tag: True,<br>        }<br>    ],<br>    &quot;static_url_path&quot;: &quot;/flasgger_static&quot;,<br>    &quot;swagger_ui&quot;: True,<br>    &quot;specs_route&quot;: &quot;/apidocs/&quot;,<br>    <br>}<br>swagger = Swagger(app, template=swagger_template,config=swagger_config)<br><br>model= joblib.load(&#39;wqmodel.sav&#39;)<br><br>#################################################################################################################################################################################<br>@swag_from(&quot;docs/predict.yaml&quot; )<br>@app.route(&quot;/predict&quot;,methods = [&quot;POST&quot;]) <br>def predict():<br>    data = {} # dictionary to store result <br>    data[&#39;code&#39;] = 1<br>    data_n = request.get_json()<br>    if request.method == &quot;POST&quot;:<br>        try:<br>            array= np.array(data_n[&quot;array&quot;])<br>            <br>        except KeyError:<br>            return jsonify({&quot;responseCode&quot;: &quot;2&quot;,&quot;responseDesc&quot;: &quot;Invalid data Key&quot;}), 400<br>                        <br>        if len(array)!=11:<br>            print(&quot;Array Input InComplete..&quot;)<br>            data[&#39;response&#39;] = &#39;Input Reading Error: Input is Incomplete&#39;<br>            return jsonify({&quot;responseCode&quot;: &quot;3&quot;,&quot;responseDesc&quot;: &quot;Input Reading Error: Input is Incomplete&quot;}), 401<br><br>        else:<br>            array=array.reshape(1,11)<br>            prediction = model.predict(array)<br>            data[&#39;code&#39;] = 0<br>            data[&#39;response&#39;] = &#39;Model prediction PASSED&#39;<br>            data[&#39;prediction&#39;] = prediction<br>            response={&quot;responseCode&quot;: &quot;0&quot;,&quot;responseDesc&quot;: &quot;SUCCESS&quot;,&quot;Wine Quality&quot;: prediction[0]}       <br>            return jsonify(response),200<br>               <br>    else:<br>        return jsonify({&quot;responseCode&quot;: &quot;1&quot;,&quot;responseDesc&quot;: &quot;Method Not Allowed&quot;}), 405<br><br>if __name__ == &#39;__main__&#39;:<br>    print((&quot;* Loading model and Flask starting server...&quot;<br>                &quot;please wait until server has fully started&quot;)) <br>    app.run(host=&#39;0.0.0.0&#39;, threaded=True, port=8085 , debug=False)</pre><p>You can access your swagger UI at you “base path” + “specs route” mentioned in the script. My one would be, <a href="http://localhost:5000/apidocs/">http://localhost:5000/apidocs/</a>. The following figure depicts the UI you can visit using the above link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVXWQ4x-4mqN8NU7jpTdFw.png" /><figcaption>Swagger UI</figcaption></figure><p>When you click on top of the /predict widget it collapses and shows your specifications to the extent you mentioned in the yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*IO-ReTsPjcQ4QOj_6dY97w.png" /><figcaption>Swagger UI Expanded</figcaption></figure><p>Let’s try out the predict endpoint!</p><p>Once you click the<strong> try it out </strong>button you will get the example in an editable area, and you can edit and execute it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*hnXEH9-KqILrCD5Ae6xCYA.png" /><figcaption>Trying out the predict API</figcaption></figure><p>The UI outputs the wine quality successfully.</p><p>You can receive the documentation for this API at <a href="http://localhost:5000/Wine_Quality_Prediction.json">http://localhost:5000/Wine_Quality_Prediction.json</a> , same as we specified in the swagger template.</p><p>It is possible to include security features, auth tokens, and any type of input and output data differing to the ones we used here. Hope this helps you to figure out an easy way to document and build a UI to test your python flask API.</p><p><strong>References</strong></p><ol><li><a href="https://pypi.org/project/flasgger/">flasgger · PyPI</a></li></ol><p><a href="https://www.kaggle.com/datasets/uciml/red-wine-quality-cortez-et-al-2009">2. https://medium.com/r/?url=https%3A%2F%2Fwww.kaggle.com%2Fdatasets%2Fuciml%2Fred-wine-quality-cortez-et-al-2009</a></p><p>3. <a href="https://swagger.io/">API Documentation &amp; Design Tools for Teams | Swagger</a></p><p><strong><em>Disclaimer</em></strong><em>: ADL is not responsible for any damage caused byanyofthearticlesto internal or external parties.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bf1c8fc0178" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-ai-analytics-corner/swagger-ui-to-your-python-flask-api-9bf1c8fc0178">Swagger UI to your Python Flask API</a> was originally published in <a href="https://medium.com/the-ai-analytics-corner">ADL AI &amp; Analytics Corner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>