{"id":337987,"date":"2025-12-10T18:14:52","date_gmt":"2025-12-10T18:14:52","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/fastapi-machine-learning-deployment-a-step-by-step-guide\/"},"modified":"2025-12-10T18:14:52","modified_gmt":"2025-12-10T18:14:52","slug":"fastapi-machine-learning-deployment-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=337987","title":{"rendered":"FastAPI Machine Learning Deployment: A Step-by-Step Guide"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"article-start\">\n<p>The majority of people build machine learning models in an experimental or research setting, which is appropriate for exploration. It is not until you start to deploy it within real applications that you\u2019ll see the actual value, for instance, a web application requesting predictions from your model, or a backend application needing to make real-time decisions based on your trained model. You want a simple, reliable way to expose your trained machine learning model as a web service, that is to say, an API.<\/p>\n<p>The FastAPI is a perfect choice for this task.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-fastapi\">What is FastAPI?<\/h2>\n<p>FastAPI is a Python web framework that is designed to help developers build RESTful APIs. It is fast, simple, and has many features included by default, such as automatic generation of API documentation. FastAPI also plays nicely with Python\u2019s existing libraries for data processing and is therefore an ideal option for machine learning projects.\u00a0<\/p>\n<p>The key advantages of utilizing <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2022\/08\/getting-started-with-restful-apis-and-fast-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">FastAPI<\/a> are:\u00a0<\/p>\n<ol class=\"wp-block-list\">\n<li><strong>Fast Performance: <\/strong>FastAPI is one of the fastest available web frameworks for the <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2021\/05\/introduction-to-python-programming-beginners-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python<\/a> programming language, as it was built upon two popular libraries: Starlette and Pydantic.\u00a0<\/li>\n<li><strong>Easy Development and Maintenance:<\/strong> Writing clean APIs with FastAPI requires minimal code thanks to the automated capabilities of FastAPI, which include automatic validation, serialization, and input checks.\u00a0<\/li>\n<li><strong>Built-In API Documentation: <\/strong>All APIs built with FastAPI automatically include a built-in Swagger interface at the URL endpoint <code>\/docs<\/code>. These allow users to test their API endpoints directly from their web browser.\u00a0<\/li>\n<li><strong>Ideal for Machine Learning Models: <\/strong>By using FastAPI, the users may define their input schema for their machine learning models, expose the model\u2019s endpoint for a prediction, and just share the location of the saved file of the model so it can be loaded into memory upon application startup. All that backend work is taken care of by FastAPI. Therefore, FastAPI has gained immense popularity among developers who deploy machine learning models.\u00a0<\/li>\n<\/ol>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"827\" height=\"59\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image9.webp\" alt=\"FastAPI Cycle\" class=\"wp-image-247676\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image9.webp 827w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image9-300x21.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image9-768x55.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image9-150x11.webp 150w\" sizes=\"auto, (max-width: 827px) 100vw, 827px\"\/><\/figure>\n<\/div>\n<p>This figure depicts a prediction request\u2019s flow through the system: data is sent by a user to the FastAPI application, which loads the trained machine learning model and runs the inference. A prediction is produced by the model, and this result is returned by the API in JSON format.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-deploying-an-ml-model-with-fastapi-hands-on-tutorial\">Deploying An ML Model With FastAPI Hands-On Tutorial<\/h2>\n<p>Below, you will find a completely hands-on guide for building machine learning model web APIs. But before that, let\u2019s see the folder structure.\u00a0<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-folder-structure-nbsp\">Folder Structure\u00a0<\/h4>\n<p>The folder structure helps in organizing the project files into a simple structure; this makes the identification of where each part of the application belongs easier.\u00a0<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"568\" height=\"263\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_imagea.webp\" alt=\"Directory Structure\" class=\"wp-image-247677\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_imagea.webp 568w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_imagea-300x139.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_imagea-150x69.webp 150w\" sizes=\"(max-width: 568px) 100vw, 568px\"\/><\/figure>\n<\/div>\n<p>Now, let\u2019s see what each part does\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>main.py<\/strong><br \/>Runs FastAPI, loads the trained model, and exposes the prediction endpoint.\u00a0<\/li>\n<li><strong>train_model.py<\/strong><br \/>Creates and saves the machine learning model that FastAPI will load.\u00a0<\/li>\n<li><strong>models\/<\/strong><br \/>Stores trained model artifacts. This folder will be created if it does not already exist.\u00a0<\/li>\n<li><strong>requirements.txt<\/strong><br \/>Not required but recommended so others can install everything with one command.\u00a0<\/li>\n<li><strong>.venv\/<\/strong><br \/>Contains your virtual environment to keep dependencies isolated.\u00a0<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-step-1-project-setup\">Step 1: Project setup<\/h2>\n<h3 class=\"wp-block-heading\" id=\"h-1-1-create-your-project-directory-nbsp\">1.1 Create Your Project Directory\u00a0<\/h3>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"483\" height=\"39\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image-1.webp\" alt=\"Creating project directory\" class=\"wp-image-247668\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image-1.webp 483w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image-1-300x24.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image-1-150x12.webp 150w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\"\/><\/figure>\n<\/div>\n<p>Create the\u00a0project directory where all of your code, files and resources for this project will be located.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-1-2-create-a-virtual-environment\">1.2 Create a virtual environment<\/h3>\n<p>A virtual environment isolates your dependencies for your project from other projects on your computer.\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>python -m venv .venv<\/code><\/pre>\n<p><strong>Activate it:\u00a0<\/strong><\/p>\n<p>Windows\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>.venv\\Scripts\\activate<\/code><\/pre>\n<p>macOS\/Linux\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>source .venv\/bin\/activate<\/code><\/pre>\n<p>When your environment is up and running, you should see \u201c(.venv)\u201d ahead of the terminal.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-1-3-install-required-dependencies-nbsp\">1.3 Install required dependencies\u00a0<\/h3>\n<p>Below is a list of Python libraries we will be using in our FastAPI web server:<\/p>\n<ul class=\"wp-block-list\">\n<li>FastAPI (the main framework for building web APIs)\u00a0<\/li>\n<li>Uvicorn (the ASGI web server for hosting FastAPI applications)\u00a0<\/li>\n<li>Scikit-Learn (to be used as a model trainer)\u00a0<\/li>\n<li>Pydantic (for automatic input validation)\u00a0<\/li>\n<li>Joblib (to persist saving\/loading ML models)\u00a0<\/li>\n<\/ul>\n<p><strong>Install them:\u00a0<\/strong><\/p>\n<pre class=\"wp-block-code\"><code>pip install fastapi uvicorn scikit-learn pydantic joblib\u00a0<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-step-2-train-and-save-a-simple-ml-model\">Step 2: Train and save a simple ML model<\/h2>\n<p>For this demonstration, our classifier will be trained on the classic Iris dataset and the model will be saved to disk. The saved model will then be loaded into our FastAPI web application.\u00a0\u00a0<\/p>\n<p>To train and save our model, we\u2019ll create a file called <em>train_model.py<\/em>:\u00a0<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"136\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image2-1.webp\" alt=\"Training a simple ML model\" class=\"wp-image-247669\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image2-1.webp 298w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image2-1-150x68.webp 150w\" sizes=\"auto, (max-width: 298px) 100vw, 298px\"\/><\/figure>\n<\/div>\n<pre class=\"wp-block-code\"><code># train_model.py\nfrom sklearn.datasets import load_iris\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.ensemble import RandomForestClassifier\nimport joblib\nfrom pathlib import Path\n\nMODEL_PATH = Path(\"models\")\nMODEL_PATH.mkdir(exist_ok=True)\nMODEL_FILE = MODEL_PATH \/ \"iris_model.joblib\"\n\ndef train_and_save_model():\niris = load_iris()\nX = iris.data\ny = iris.target\n\n\u00a0 \u00a0 X_train, X_test, y_train, y_test = train_test_split(\n\u00a0 \u00a0 X, y, test_size=0.2, random_state=42, stratify=y\n)\n\n\u00a0 \u00a0 clf = RandomForestClassifier(\n\u00a0 \u00a0 \u00a0 \u00a0 n_estimators=100,\n\u00a0 \u00a0 \u00a0 \u00a0 random_state=42\n)\n\u00a0 \u00a0 clf.fit(X_train, y_train)\n\naccuracy = clf.score(X_test, y_test)\nprint(f\"Test accuracy: {accuracy:.3f}\")\n\n\u00a0 \u00a0 joblib.dump(\n\u00a0 \u00a0 {\n\u00a0 \u00a0 \u00a0 \u00a0 \"model\": clf,\n\u00a0 \u00a0 \u00a0 \u00a0 \"target_names\": iris.target_names,\n\u00a0 \u00a0 \u00a0 \u00a0 \"feature_names\": iris.feature_names,\n\u00a0 \u00a0 },\n\u00a0 \u00a0 MODEL_FILE,\n)\nprint(f\"Saved model to {MODEL_FILE.resolve()}\")\n\nif __name__ == \"__main__\":\n\u00a0 \u00a0 train_and_save_model()<\/code><\/pre>\n<p>Install joblib if needed:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>pip install joblib<\/code><\/pre>\n<p>Run the script:\u00a0<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"60\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image3-1.webp\" alt=\"Executing the Python script\" class=\"wp-image-247670\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image3-1.webp 684w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image3-1-300x26.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image3-1-150x13.webp 150w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\"\/><\/figure>\n<\/div>\n<p>Once the model has been successfully trained, you should see the accuracy printed to the terminal and a new model file will also be created which will be used for loading in FastAPI.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-step-3-create-a-fastapi-program-that-will-deliver-the-predictions-of-your-model\">Step 3: Create a FastAPI program that will deliver the predictions of your model<\/h2>\n<p>In this step, we will create an API that can\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li>Load the trained Machine Learning model on start up\u00a0<\/li>\n<li>Create an input schema that can be used to validate the data sent to the API\u00a0<\/li>\n<li>Call the \/predict endpoint defined in the previous step to create an output based on the model\u2019s predictions.\u00a0<\/li>\n<\/ul>\n<p>Create<em> main.py<\/em>:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code># main.py\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel, Field\nfrom typing import List\nimport joblib\nfrom pathlib import Path\n\nMODEL_FILE = Path(\"models\/iris_model.joblib\")\n\nclass IrisFeatures(BaseModel):\n\u00a0 \u00a0 sepal_length: float = Field(..., example=5.1)\n\u00a0 \u00a0 sepal_width: float = Field(..., example=3.5)\n\u00a0 \u00a0 petal_length: float = Field(..., example=1.4)\n\u00a0 \u00a0 petal_width: float = Field(..., example=0.2)\n\nclass PredictionResult(BaseModel):\n\u00a0 \u00a0 predicted_class: str\n\u00a0 \u00a0 predicted_class_index: int\nprobabilities: List[float]\n\napp = FastAPI(\ntitle=\"Iris Classifier API\",\ndescription=\"A simple FastAPI service that serves an Iris classification model.\",\nversion=\"1.0.0\",\n)\n\nmodel = None\ntarget_names = None\nfeature_names = None\n\n@app.on_event(\"startup\")\ndef load_model():\nglobal model, target_names, feature_names\n\nif not MODEL_FILE.exists():\n\u00a0 \u00a0 raise RuntimeError(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 f\"Model file not found at {MODEL_FILE}. \"\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 f\"Run train_model.py first.\"\n\u00a0 \u00a0 )\n\nartifact = joblib.load(MODEL_FILE)\nmodel = artifact[\"model\"]\n\u00a0 \u00a0 target_names = artifact[\"target_names\"]\n\u00a0 \u00a0 feature_names = artifact[\"feature_names\"]\n\u00a0 \u00a0 print(\"Model loaded successfully.\")\n\n@app.get(\"\/\")\ndef root():\nreturn {\n\u00a0 \u00a0 \"message\": \"Welcome to the Iris ML API\",\n\u00a0 \u00a0 \"predict_endpoint\": \"\/predict\",\n\u00a0 \u00a0 \"docs\": \"\/docs\",\n}\n\n@app.post(\"\/predict\", response_model=PredictionResult)\ndef predict(features: IrisFeatures):\nif model is None:\n\u00a0 \u00a0 raise RuntimeError(\"Model is not loaded.\")\n\nX = [[\n\u00a0 \u00a0 \u00a0 \u00a0 features.sepal_length,\n\u00a0 \u00a0 \u00a0 \u00a0 features.sepal_width,\n\u00a0 \u00a0 \u00a0 \u00a0 features.petal_length,\n\u00a0 \u00a0 \u00a0 \u00a0 features.petal_width,\n]]\n\n\u00a0 \u00a0 proba = model.predict_proba(X)[0]\n\u00a0 \u00a0 class_index = int(proba.argmax())\n\u00a0 \u00a0 class_name = str(target_names[class_index])\n\nreturn PredictionResult(\n\u00a0 \u00a0 \u00a0 \u00a0 predicted_class=class_name,\n\u00a0 \u00a0 \u00a0 \u00a0 predicted_class_index=class_index,\n\u00a0 \u00a0 probabilities=proba.tolist(),\n)<\/code><\/pre>\n<p>This file contains all of the code that will allow the <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/06\/machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\">Machine Learning<\/a> model to function as a web app.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-step-4-running-and-testing-the-api-locally\">Step 4: Running and testing the API locally<\/h2>\n<h3 class=\"wp-block-heading\" id=\"h-4-1-start-the-server-nbsp\">4.1 Start the server\u00a0<\/h3>\n<p>Run:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>uvicorn main:app \u2013reload\u00a0<\/code><\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"167\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image4-1.webp\" alt=\"Starting the server\" class=\"wp-image-247671\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image4-1.webp 729w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image4-1-300x69.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image4-1-150x34.webp 150w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\"\/><\/figure>\n<\/div>\n<p>The app starts at:\u00a0http:\/\/127.0.0.1:8000\/<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"103\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image5-1.webp\" alt=\"Application starts at localhost\" class=\"wp-image-247672\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image5-1.webp 753w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image5-1-300x41.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image5-1-150x21.webp 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\"\/><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-testing-the-api-using-the-interactive-documentation-provided-by-fastapi-nbsp\">4.2 Testing the API using the interactive documentation provided by FastAPI\u00a0<\/h3>\n<p>FastAPI provides built-in Swagger documentation at:\u00a0http:\/\/127.0.0.1:8000\/docs<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1680\" height=\"908\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6.webp\" alt=\"Iris Classifier API\" class=\"wp-image-247673\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6.webp 1680w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6-300x162.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6-768x415.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6-1536x830.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image6-150x81.webp 150w\" sizes=\"auto, (max-width: 1680px) 100vw, 1680px\"\/><\/figure>\n<\/div>\n<p>There you will find:\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li>A GET endpoint <code>\/<\/code><\/li>\n<li>A POST endpoint <code>\/predict\u00a0<\/code><\/li>\n<\/ul>\n<p>Try the <code>\/predict<\/code> endpoint by clicking <strong>Try it out<\/strong> and entering:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>{\n\u00a0 \"sepal_length\": 5.1,\n\u00a0 \"sepal_width\": 3.5,\n\u00a0 \"petal_length\": 1.4,\n\u00a0 \"petal_width\": 0.2\n}<\/code><\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1406\" height=\"478\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7.webp\" alt=\"Using the predict endpoint\" class=\"wp-image-247674\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7.webp 1406w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7-300x102.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7-768x261.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7-350x120.webp 350w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image7-150x51.webp 150w\" sizes=\"auto, (max-width: 1406px) 100vw, 1406px\"\/><\/figure>\n<\/div>\n<p>You will get a prediction like:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>{ \n  \"predicted_class\": \"setosa\", \n  \"predicted_class_index\": 0, \n  \"probabilities\": [1, 0, 0] \n} <\/code><\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1401\" height=\"322\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image8.webp\" alt=\"Predicted output\" class=\"wp-image-247675\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image8.webp 1401w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image8-300x69.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image8-768x177.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/12\/media_image8-150x34.webp 150w\" sizes=\"auto, (max-width: 1401px) 100vw, 1401px\"\/><\/figure>\n<\/div>\n<p>Your ML model is now fully deployed as an API.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-deploy-to-cloud-nbsp\">Deploy to Cloud\u00a0<\/h3>\n<p>Once you have your FastAPI application running on your local machine, you can deploy it on the cloud so that it is accessible from anywhere. You do not have to bother about any container setup for this. A few services make it pretty straightforward.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-deploy-on-render-nbsp\">Deploy on Render\u00a0<\/h3>\n<p>Render is one of the fastest ways to put a FastAPI app online.\u00a0<\/p>\n<ol class=\"wp-block-list\">\n<li>Push your project to GitHub.\u00a0<\/li>\n<li>Create a new Web Service on Render.\u00a0<\/li>\n<li>Set the build command:\u00a0<\/li>\n<\/ol>\n<pre class=\"wp-block-code\"><code>pip install -r requirements.txt<\/code><\/pre>\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Set the start command:\u00a0<\/li>\n<\/ol>\n<pre class=\"wp-block-code\"><code>uvicorn main:app --host 0.0.0.0 --port 10000<\/code><\/pre>\n<p>Render will install your packages, start your app, and give you a public link. Anyone can now send requests to your model.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-deploy-to-github-codespaces-nbsp\">Deploy to GitHub Codespaces\u00a0<\/h3>\n<p>If you only want a simple online environment without the extra setup, Codespaces can run your FastAPI app.\u00a0<\/p>\n<ol class=\"wp-block-list\">\n<li>Open your repository in Codespaces.\u00a0<\/li>\n<li>Install your dependencies.\u00a0<\/li>\n<li>Launch the application:\u00a0<\/li>\n<\/ol>\n<pre class=\"wp-block-code\"><code>uvicorn main:app --host 0.0.0.0 --port 8000<\/code><\/pre>\n<p>Codespaces exposes the port, so you can directly open the link from your browser. This is good to test or to share a quick demo.\u00a0<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-deploy-on-aws-ec2-nbsp\">Deploy on AWS EC2\u00a0<\/h3>\n<p>You can use an EC2 instance if you want to be in control of your own server.\u00a0<\/p>\n<ol class=\"wp-block-list\">\n<li>Launch a small EC2 machine.\u00a0<\/li>\n<li>Install Python and pip.\u00a0<\/li>\n<li>Clone your project.\u00a0<\/li>\n<li>Install the requirements:\u00a0<\/li>\n<\/ol>\n<pre class=\"wp-block-code\"><code>pip install -r requirements.txt<\/code><\/pre>\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Start the API:\u00a0<\/li>\n<\/ol>\n<pre class=\"wp-block-code\"><code>uvicorn main:app --host 0.0.0.0 --port 8000<\/code><\/pre>\n<p>Make sure port 8000 is open in your EC2 security settings. Your API will be available at the machine\u2019s public IP address.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-common-errors-and-fixes\">Common Errors and Fixes<\/h2>\n<p>Here are a few issues you may run into while building or running the project, along with simple ways to fix them.\u00a0<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-model-file-not-found-nbsp\">Model file not found\u00a0<\/h4>\n<ol class=\"wp-block-list\"\/>\n<p>This usually means the training script was never run. Run:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>python train_model.py<\/code><\/pre>\n<p>Check that the model file appears inside the model\u2019s folder.\u00a0<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-missing-libraries-nbsp\">Missing libraries\u00a0<\/h4>\n<ol start=\"2\" class=\"wp-block-list\"\/>\n<p>If you see messages about missing modules, make sure your virtual environment is active:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>source .venv\/bin\/activate<\/code><\/pre>\n<p>Then reinstall the required libraries:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>pip install fastapi uvicorn scikit-learn pydantic joblib<\/code><\/pre>\n<h4 class=\"wp-block-heading\" id=\"h-uvicorn-reload-issue-nbsp\">Uvicorn reload issue\u00a0<\/h4>\n<ol start=\"3\" class=\"wp-block-list\"\/>\n<p>Some commands online use the wrong type of dash.<br \/>If this fails:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>uvicorn main:app \u2013reload<\/code><\/pre>\n<p>Use this instead:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>uvicorn main:app --reload<\/code><\/pre>\n<h4 class=\"wp-block-heading\" id=\"h-browser-cannot-call-the-api-nbsp\">Browser cannot call the API\u00a0<\/h4>\n<ol start=\"4\" class=\"wp-block-list\"\/>\n<p>If you see CORS errors when a frontend calls the API, add this block to your FastAPI app:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>from fastapi.middleware.cors import CORSMiddleware\n\napp.add_middleware(\n\u00a0 \u00a0 CORSMiddleware,\n\u00a0 \u00a0 allow_origins=[\"*\"],\n\u00a0 \u00a0 allow_methods=[\"*\"],\n\u00a0 \u00a0 allow_headers=[\"*\"],\n)<\/code><\/pre>\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Input shape errors\u00a0<\/li>\n<\/ol>\n<p>Scikit-learn expects the input as a list of lists. Make sure your data is shaped like this:\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>X = [[\n\u00a0 \u00a0 features.sepal_length,\n\u00a0 \u00a0 features.sepal_width,\n\u00a0 \u00a0 features.petal_length,\n\u00a0 \u00a0 features.petal_width,\n]]<\/code><\/pre>\n<p>This avoids most shape related errors.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n<p>Machine Learning model Deployment needs to be simpl. However, using FastAPI you should be able to easily create an API that is easy to read and understand with only a few lines of code. FastAPI takes care of all the set up, validation and documentation for you and this leaves you free to concentrate on your model. This method helps people transition from testing and developing to full implementation in the real world. Whether you are making prototypes, demos or production services, using FastAPI you can now share your models and deploy them to production quickly and easily.\u00a0<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\">Frequently Asked Questions<\/h2>\n<div class=\"schema-faq wp-block-yoast-faq-block\">\n<div class=\"schema-faq-section\" id=\"faq-question-1765265062747\"><strong class=\"schema-faq-question\">Q1. What makes FastAPI a good fit for deploying machine learning models?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. It loads your model at startup, validates inputs automatically, exposes clean prediction endpoints, and gives you built-in interactive docs. That keeps your deployment code simple while the framework handles most of the plumbing.\u00a0<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1765265073628\"><strong class=\"schema-faq-question\">Q2. Why do I need to run the training script before starting the API?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. The API loads a saved model file on startup.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1765265081983\"><strong class=\"schema-faq-question\">Q3. How can I test the prediction endpoint without writing any client code?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. FastAPI ships with Swagger docs at \/docs. You can open it in a browser, fill in sample inputs for \/predict, and submit a request to see real outputs from your model.\u00a0<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<div class=\"border-top py-3 author-info my-4\">\n<div class=\"author-card d-flex align-items-center\">\n<div class=\"flex-shrink-0 overflow-hidden\">\n                                    <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/author\/janvikumari01\/\" class=\"text-decoration-none active-avatar\"><br \/>\n                                                                       <img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/lekhak-profile-images\/converted_image_ToTu2tx.webp\" width=\"48\" height=\"48\" alt=\"Janvi Kumari\" loading=\"lazy\" class=\"rounded-circle\"\/><\/p>\n<p>                                <\/a>\n                                <\/div>\n<\/p><\/div>\n<p>Hi, I am Janvi, a passionate data science enthusiast currently working at Analytics Vidhya. My journey into the world of data began with a deep curiosity about how we can extract meaningful insights from complex datasets.<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<p><h4 class=\"fs-24 text-dark\">Login to continue reading and enjoy expert-curated content.<\/h4>\n<p>                        <button class=\"btn btn-primary mx-auto d-table\" data-bs-toggle=\"modal\" data-bs-target=\"#loginModal\" id=\"readMoreBtn\">Keep Reading for Free<\/button>\n                    <\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>The majority of people build machine learning models in an experimental or research setting, which is appropriate for exploration. It is not until you start to deploy it within real applications that you\u2019ll see the actual value, for instance, a web application requesting predictions from your model, or a backend application needing to make real-time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":337988,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[6648,113073,2059,1554,1952,11372],"dealstore":[],"offerexpiration":[],"class_list":["post-337987","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-deployment","tag-fastapi","tag-guide","tag-learning","tag-machine","tag-stepbystep"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=337987\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"The majority of people build machine learning models in an experimental or research setting, which is appropriate for exploration. It is not until you start to deploy it within real applications that you\u2019ll see the actual value, for instance, a web application requesting predictions from your model, or a backend application needing to make real-time [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=337987\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-10T18:14:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"872\" \/>\n\t<meta property=\"og:image:height\" content=\"473\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=337987#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"FastAPI Machine Learning Deployment: A Step-by-Step Guide\",\"datePublished\":\"2025-12-10T18:14:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987\"},\"wordCount\":1516,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp\",\"keywords\":[\"Deployment\",\"FastAPI\",\"Guide\",\"Learning\",\"Machine\",\"StepbyStep\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=337987#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=337987\",\"url\":\"https:\/\/fivemor.com\/?p=337987\",\"name\":\"FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp\",\"datePublished\":\"2025-12-10T18:14:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=337987#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=337987\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=337987#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp\",\"width\":872,\"height\":473},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=337987#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FastAPI Machine Learning Deployment: A Step-by-Step Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=337987","og_locale":"en_US","og_type":"article","og_title":"FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network","og_description":"The majority of people build machine learning models in an experimental or research setting, which is appropriate for exploration. It is not until you start to deploy it within real applications that you\u2019ll see the actual value, for instance, a web application requesting predictions from your model, or a backend application needing to make real-time [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=337987","og_site_name":"Som2ny Network","article_published_time":"2025-12-10T18:14:52+00:00","og_image":[{"width":872,"height":473,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=337987#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=337987"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"FastAPI Machine Learning Deployment: A Step-by-Step Guide","datePublished":"2025-12-10T18:14:52+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=337987"},"wordCount":1516,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=337987#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp","keywords":["Deployment","FastAPI","Guide","Learning","Machine","StepbyStep"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=337987#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=337987","url":"https:\/\/fivemor.com\/?p=337987","name":"FastAPI Machine Learning Deployment: A Step-by-Step Guide - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=337987#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=337987#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp","datePublished":"2025-12-10T18:14:52+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=337987#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=337987"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=337987#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/12\/Building-an-Deploying-a-Model-Using-FastAPI-1.webp.webp","width":872,"height":473},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=337987#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"FastAPI Machine Learning Deployment: A Step-by-Step Guide"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/337987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=337987"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/337987\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/337988"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337987"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=337987"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=337987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}