<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Usage of MLFlow models inside Streamlit app in Databricks in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/usage-of-mlflow-models-inside-streamlit-app-in-databricks/m-p/142548#M51969</link>
    <description>&lt;P&gt;Authentication context isn’t automatically available in Apps. Notebooks automatically inject workspace host and token for mlflow when you use mlflow.set_tracking_uri("databricks") and mlflow.set_registry_uri("databricks-uc"). In Databricks Apps, you typically must supply credentials explicitly via environment variables (for example, DATABRICKS_HOST and DATABRICKS_TOKEN) or by using a Databricks CLI profile in the URIs (for example, databricks-uc://&amp;lt;profile&amp;gt;).&lt;/P&gt;
&lt;P&gt;The app runs under an app service principal or (if configured) on-behalf-of the user. That identity must have UC privileges on the model’s catalog/schema (USE CATALOG, USE SCHEMA) and read access to the registered model to download artifacts through MLflow APIs.&lt;/P&gt;
&lt;P&gt;put your mlflow.pyfunc.load_model(...) in try/except and display exceptions with st.exception(e) to diagnose the root cause instead of failing silently.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Dec 2025 15:31:49 GMT</pubDate>
    <dc:creator>iyashk-DB</dc:creator>
    <dc:date>2025-12-25T15:31:49Z</dc:date>
    <item>
      <title>Usage of MLFlow models inside Streamlit app in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/usage-of-mlflow-models-inside-streamlit-app-in-databricks/m-p/142536#M51968</link>
      <description>&lt;P&gt;I have an issue with loading registered MLflow model into streamlit app inside the Databricks&lt;BR /&gt;&lt;BR /&gt;This is the sample code used for model load:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; mlflow&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; mlflow.tracking &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; MlflowClient&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;mlflow.&lt;/SPAN&gt;&lt;SPAN&gt;set_tracking_uri&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"databricks"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mlflow.&lt;/SPAN&gt;&lt;SPAN&gt;set_registry_uri&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"databricks-uc"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;client &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;MlflowClient&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;model_uri &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"models:/workspace.default.xgboost_units/2"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;model &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; mlflow.pyfunc.&lt;/SPAN&gt;&lt;SPAN&gt;load_model&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;model_uri&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;model_uri)&lt;BR /&gt;The streamlit app served with the databricks app is failing silently loading this model, why the same code inside the databricks python notebook is working without any issues.&lt;BR /&gt;&lt;BR /&gt;Any thoughts what can be the reason? Or maybe there is sample app which uses MLflow models successfully?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;mlflow==2.22.0 in both envs&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Dec 2025 17:50:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/usage-of-mlflow-models-inside-streamlit-app-in-databricks/m-p/142536#M51968</guid>
      <dc:creator>pavelhym</dc:creator>
      <dc:date>2025-12-24T17:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Usage of MLFlow models inside Streamlit app in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/usage-of-mlflow-models-inside-streamlit-app-in-databricks/m-p/142548#M51969</link>
      <description>&lt;P&gt;Authentication context isn’t automatically available in Apps. Notebooks automatically inject workspace host and token for mlflow when you use mlflow.set_tracking_uri("databricks") and mlflow.set_registry_uri("databricks-uc"). In Databricks Apps, you typically must supply credentials explicitly via environment variables (for example, DATABRICKS_HOST and DATABRICKS_TOKEN) or by using a Databricks CLI profile in the URIs (for example, databricks-uc://&amp;lt;profile&amp;gt;).&lt;/P&gt;
&lt;P&gt;The app runs under an app service principal or (if configured) on-behalf-of the user. That identity must have UC privileges on the model’s catalog/schema (USE CATALOG, USE SCHEMA) and read access to the registered model to download artifacts through MLflow APIs.&lt;/P&gt;
&lt;P&gt;put your mlflow.pyfunc.load_model(...) in try/except and display exceptions with st.exception(e) to diagnose the root cause instead of failing silently.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Dec 2025 15:31:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/usage-of-mlflow-models-inside-streamlit-app-in-databricks/m-p/142548#M51969</guid>
      <dc:creator>iyashk-DB</dc:creator>
      <dc:date>2025-12-25T15:31:49Z</dc:date>
    </item>
  </channel>
</rss>

