From a3363bf912b5cb323cb256a6ab315639a93618ef Mon Sep 17 00:00:00 2001 From: pedrozanlorensi Date: Thu, 23 Oct 2025 13:40:55 +0000 Subject: [PATCH 1/5] dummy change --- .../model-training.ipynb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb b/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb index 1e6f1ce..a9247df 100644 --- a/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb +++ b/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb @@ -18,7 +18,8 @@ }, "outputs": [], "source": [ - "# This notebook is meant to train a classification model from the Iris dataset and save it to the UC" + "# This notebook is meant to train a classification model from the Iris dataset and save it to the UC\n", + "# Dummy comment" ] }, { @@ -322,21 +323,21 @@ "label": null, "name": "catalog_name", "options": { - "validationRegex": null, - "widgetDisplayType": "Text" + "widgetDisplayType": "Text", + "validationRegex": null }, "parameterDataType": "String" }, "widgetInfo": { + "widgetType": "text", "defaultValue": "pedroz_e2edata_dev", "label": null, "name": "catalog_name", "options": { + "widgetType": "text", "autoCreated": null, - "validationRegex": null, - "widgetType": "text" - }, - "widgetType": "text" + "validationRegex": null + } } } } From d4d3219d41fcab842d0db7964aec1d5d40615f25 Mon Sep 17 00:00:00 2001 From: pedrozanlorensi Date: Thu, 23 Oct 2025 18:34:29 +0000 Subject: [PATCH 2/5] dummy change --- Notebooks/1_DataPreprocessing/data-ingestion.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Notebooks/1_DataPreprocessing/data-ingestion.ipynb b/Notebooks/1_DataPreprocessing/data-ingestion.ipynb index 291cd4d..449df11 100644 --- a/Notebooks/1_DataPreprocessing/data-ingestion.ipynb +++ b/Notebooks/1_DataPreprocessing/data-ingestion.ipynb @@ -18,7 +18,8 @@ }, "outputs": [], "source": [ - "# This notebook is meant to extract the data from sklearn.datasets and ingest it into a table in the UC" + "# This notebook is meant to extract the data from sklearn.datasets and ingest it into a table in the UC\n", + "# Dummy change" ] }, { From 7fe6a04262e6cf295faf6b74657c8b9b20705c4a Mon Sep 17 00:00:00 2001 From: pedrozanlorensi Date: Thu, 30 Oct 2025 15:30:00 +0000 Subject: [PATCH 3/5] comment removed --- Notebooks/1_DataPreprocessing/data-ingestion.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Notebooks/1_DataPreprocessing/data-ingestion.ipynb b/Notebooks/1_DataPreprocessing/data-ingestion.ipynb index 449df11..291cd4d 100644 --- a/Notebooks/1_DataPreprocessing/data-ingestion.ipynb +++ b/Notebooks/1_DataPreprocessing/data-ingestion.ipynb @@ -18,8 +18,7 @@ }, "outputs": [], "source": [ - "# This notebook is meant to extract the data from sklearn.datasets and ingest it into a table in the UC\n", - "# Dummy change" + "# This notebook is meant to extract the data from sklearn.datasets and ingest it into a table in the UC" ] }, { From 6314af36f29f89308dc2416bffb8dd45766bab2d Mon Sep 17 00:00:00 2001 From: pedrozanlorensi Date: Wed, 26 Nov 2025 21:10:41 +0000 Subject: [PATCH 4/5] update realtime-inference example --- .../3_Inference/realtime-inference.ipynb | 104 ++++++------------ 1 file changed, 34 insertions(+), 70 deletions(-) diff --git a/Notebooks/3_Inference/realtime-inference.ipynb b/Notebooks/3_Inference/realtime-inference.ipynb index d480258..558f170 100644 --- a/Notebooks/3_Inference/realtime-inference.ipynb +++ b/Notebooks/3_Inference/realtime-inference.ipynb @@ -1,25 +1,13 @@ { "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# This notebook is meant to show a simple example of how to use the realtime inference endpoint" - ] - }, { "cell_type": "code", "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": { - "byteLimit": 2048000, - "rowLimit": 10000 - }, + "cellMetadata": {}, "inputWidgets": {}, - "nuid": "f558f7fa-8486-4a4d-bcc5-c9a71312e9e4", + "nuid": "c349d0aa-264d-41f5-837b-72703eb01f87", "showTitle": false, "tableResultSettingsMap": {}, "title": "" @@ -27,12 +15,7 @@ }, "outputs": [], "source": [ - "import os\n", - "import requests\n", - "import numpy as np\n", - "import pandas as pd\n", - "import json\n", - "from sklearn import datasets" + "# This notebook is meant to show a simple example of how to use the near real-time inference endpoint" ] }, { @@ -40,12 +23,9 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": { - "byteLimit": 2048000, - "rowLimit": 10000 - }, + "cellMetadata": {}, "inputWidgets": {}, - "nuid": "1afd51a3-7462-4710-89c7-8244d7f2f11f", + "nuid": "62d91fa5-5a0d-4fbc-a81b-1850fd7b8d2f", "showTitle": false, "tableResultSettingsMap": {}, "title": "" @@ -53,18 +33,7 @@ }, "outputs": [], "source": [ - "def create_tf_serving_json(data):\n", - " return {'inputs': {name: data[name].tolist() for name in data.keys()} if isinstance(data, dict) else data.tolist()}\n", - "\n", - "def score_model(dataset):\n", - " url = 'https://adb-4181970831265458.18.azuredatabricks.net/serving-endpoints/pedroz_e2edata_dev-default-iris_model-endpoint/invocations'\n", - " headers = {'Authorization': f'Bearer {os.environ.get(\"DATABRICKS_TOKEN\")}', 'Content-Type': 'application/json'}\n", - " ds_dict = {'dataframe_split': dataset.to_dict(orient='split')} if isinstance(dataset, pd.DataFrame) else create_tf_serving_json(dataset)\n", - " data_json = json.dumps(ds_dict, allow_nan=True)\n", - " response = requests.request(method='POST', headers=headers, url=url, data=data_json)\n", - " if response.status_code != 200:\n", - " raise Exception(f'Request failed with status {response.status_code}, {response.text}')\n", - " return response.json()" + "from databricks.sdk import WorkspaceClient" ] }, { @@ -77,30 +46,31 @@ "rowLimit": 10000 }, "inputWidgets": {}, - "nuid": "298490eb-582e-4ba3-8818-8617fc36c94a", + "nuid": "f82f4dff-f1f0-42da-b982-2a83442d3ba6", "showTitle": false, "tableResultSettingsMap": {}, "title": "" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/spark-d43833de-3f9d-486f-a93a-08/.ipykernel/2824/command-8394587244958649-400682212:4: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n", - " df_samples.columns = df_samples.columns.str.replace(' ', '_').str.replace('(', '').str.replace(')', '')\n", - "/home/spark-d43833de-3f9d-486f-a93a-08/.ipykernel/2824/command-8394587244958649-400682212:4: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n", - " df_samples.columns = df_samples.columns.str.replace(' ', '_').str.replace('(', '').str.replace(')', '')\n" - ] - } - ], + "outputs": [], "source": [ - "# Pull the dataset for running the inference\n", - "iris_samples = datasets.load_iris(as_frame=True)\n", - "df_samples = pd.DataFrame(data = iris_samples['data'], columns = iris_samples['feature_names'])\n", - "df_samples.columns = df_samples.columns.str.replace(' ', '_').str.replace('(', '').str.replace(')', '')\n", - "df_samples = df_samples.head(1)" + "w = WorkspaceClient()\n", + "\n", + "sample_input = [\n", + " {\n", + " \"sepal_length_cm\": 5.1,\n", + " \"sepal_width_cm\": 3.5,\n", + " \"petal_length_cm\": 1.4,\n", + " \"petal_width_cm\": 0.2\n", + " }\n", + "]\n", + "\n", + "prediction = w.serving_endpoints.query(\n", + " name=\"pedroz_e2edata_dev-default-iris_model-endpoint\",\n", + " dataframe_records=sample_input\n", + ")\n", + "\n", + "display(prediction)" ] }, { @@ -113,26 +83,20 @@ "rowLimit": 10000 }, "inputWidgets": {}, - "nuid": "5f5aa914-0c0e-4387-83e6-0e9930a2099e", + "nuid": "6f25d6d3-1170-47a6-837e-69f90f17e1dd", "showTitle": false, "tableResultSettingsMap": {}, "title": "" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'predictions': [0]}" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "score_model(df_samples)" + "print(\n", + " 'Input:',\n", + " sample_input,\n", + " '\\nOutput: ',\n", + " prediction.predictions\n", + ")" ] } ], @@ -142,7 +106,7 @@ "dashboards": [], "environmentMetadata": { "base_environment": "", - "environment_version": "2" + "environment_version": "4" }, "inputWidgetPreferences": null, "language": "python", From 43ac6d8f39232f05de1f3b974c66a7214ed32395 Mon Sep 17 00:00:00 2001 From: pedrozanlorensi Date: Wed, 26 Nov 2025 21:12:32 +0000 Subject: [PATCH 5/5] remove comment --- Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb b/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb index a9247df..ad80913 100644 --- a/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb +++ b/Notebooks/2_ModelTrainingAndDeployment/model-training.ipynb @@ -18,8 +18,7 @@ }, "outputs": [], "source": [ - "# This notebook is meant to train a classification model from the Iris dataset and save it to the UC\n", - "# Dummy comment" + "# This notebook is meant to train a classification model from the Iris dataset and save it to the UC" ] }, {