This guide demonstrates how to create a Streamlit application running inside Snowflake that unlocks insights from unstructured data using Snowflake Cortex AI.
It shows how to translate, summarize, classify text, generate emails, and even analyze images — all without deploying external infrastructure.

Prerequisites

What You'll Learn

What You'll Build

A fully functioning Streamlit app inside Snowflake that:

Login to Snowsight

Log into Snowflake's web interface Snowsight using your Snowflake credentials.

Enable Cross-Region Inference

In the Snowsight UI on the left hand sidebar, select the Projects > Worksheets tab.

In the top right hand corner, click the + button to create a new SQL worksheet.

Run the following SQL commands to enable cortex cross-region inference.

-- set role context
USE ROLE accountadmin;

-- enable Cortex Cross Region Inference
ALTER ACCOUNT SET CORTEX_ENABLED_CROSS_REGION = 'ANY_REGION';

Create Snowflake Objects

In the same SQL worksheet, run the following SQL commands to create the warehouse, database, schema, and stage

-- Set role context
USE ROLE sysdmin;

-- Set Environment Name
SET var_name = 'ai209';

-- Generate Environment Identifiers
SET var_warehouse_name = $var_name||'_wh';
SET var_database_name = $var_name||'_db';
SET var_schema_name = $var_name||'_db.demo';

-- Set Warehouse Context
CREATE WAREHOUSE IF NOT EXISTS IDENTIFIER($var_warehouse_name) WITH
    WAREHOUSE_SIZE = xsmall
    AUTO_SUSPEND = 60
    INITIALLY_SUSPENDED = true;
USE WAREHOUSE IDENTIFIER($var_warehouse_name);

-- Set Database Schema Context
CREATE DATABASE IF NOT EXISTS IDENTIFIER($var_database_name);
CREATE SCHEMA IF NOT EXISTS IDENTIFIER($var_schema_name);
USE SCHEMA IDENTIFIER($var_schema_name);
    
-- Create Images Stage
CREATE STAGE IF NOT EXISTS images_stage
    DIRECTORY = ( ENABLE = true )
    ENCRYPTION = ( TYPE = 'SNOWFLAKE_SSE' );

Download Images

Download sample images.

Upload Images

In the Snowsight UI on the left hand sidebar, select the Data > Databases tab and navigate to AI209_DB > PUBLIC > STAGES > IMAGES_STAGE.

In the top right hand corner, click + Files to upload files to the stage.

Navigate back to the SQL worksheet and run the following SQL commands to verify the files have been uploaded:

Let's create a Streamlit application for interactive image analysis:

Setting Up the Streamlit App

To create and configure your Streamlit application in Snowflake:

  1. Navigate to Streamlit in Snowflake:
    • Click on the Streamlit tab in the left navigation pane
    • Click on + Streamlit App button in the top right
  2. Configure App Settings:
    • Enter a name for your app (e.g., "AI/ML Toolkit")
    • Select the warehouse AI209_WH
    • Choose AI209_DB.PUBLIC as your database and schema
    • Click Create
  3. Create the app:
    • In the editor, paste the complete code provided in the streamlit_app.py file
    • Click "Run" to launch your application

The application provides:

Congratulations! You've successfully built an end-to-end image analysis application using Snowflake Cortex AI models. This app showcases how to unlock value from unstructured data — including text and images - all within the Snowflake environment.

By combining Snowflake-native large language models (LLMs) and multimodal capabilities with Streamlit, you built an interactive solution that can:

This end-to-end pattern demonstrates how Snowflake Cortex can power intelligent applications directly on top of your data, reducing time-to-insight and simplifying operational complexity.

What You Learned

Related Resources