This Streamlit app is not just any chatbot; it's your starter kit to play with Snowflake's brand new foundation model: Snowflake Arctic! Arctic was released on April 24, 2024 and is completely open-source 😍
Get the full lowdown on Arctic in Adrien Treuille's blog post. Snowflake Arctic is also available via Hugging Face 🤗 and all your favorite model gardens soon! 🔜
Built a cool Streamlit app using Arctic? Share it on social media with #SnowflakeArctic! We'll repost you 🫡
To use this app, you'll need to get your own Replicate API token.
After creating a Replicate account, you can access your API token from this page.
- Python 3.8 or later 🐍
- pip3 📦
-
Clone this repository
git clone https://github.com/yourusername/snowflake-arctic-chatbot.git cd snowflake-arctic-chatbot
-
Install requirements
pip install -r requirements.txt
-
Add your API token to your secrets file
Create a.streamlit
folder with asecrets.toml
file inside.mkdir .streamlit cd .streamlit touch secrets.toml
Use your text editor or IDE of choice to add the following to
secrets.toml
:REPLICATE_API_TOKEN = "your API token here"
Learn more about Streamlit secrets management in our docs.
Alternatively, you can enter your Replicate API token via the
st.text_input
widget in the app itself (once you're running the app). -
Run the Streamlit app Note: there are two versions of the app included in this repo.
simple_app.py
is a simpler app which passes user input to Arctic and returns Arctic's response.streamlit_app.py
has built-in guardrails, meaning that it checks user input to ensure queries are safe (i.e. users are not asking Arctic for instructions on how to commit illegal activity, etc.).
To run the version of the app that includes guardrails, enter:
cd ..
streamlit run streamlit_app.py
To run the simpler version of the app, enter:
cd ..
streamlit run simple_app.py
Host your app for free on Streamlit Community Cloud. These instructions are also available in our docs.
- Sign up for a Community Cloud account or log in at share.streamlit.io.
- Click "New app" from the upper-right corner of your workspace.
- Fill in your repo, branch, and file path. As a shortcut, you can also click "Paste GitHub URL" to paste a link directly to
streamlit_app.py
on GitHub.
Securely store your Replicate API token with Community Cloud's secrets management feature. These instructions are also available in our docs.
- Before clicking "Deploy", click "Advanced settings..."
- A modal will appear with an input box for your secrets.
- Provide your secrets in the "Secrets" field using TOML format. For example:
REPLICATE_API_TOKEN = "your API token here"
- Go to share.streamlit.io.
- Click the overflow menu icon (AKA hamburger icon) for your app.
- Click "Settings".
- A modal will appear. Click "Secrets" on the left.
- After you edit your secrets, click "Save". It might take a minute for the update to be propagated to your app, but the new values will be reflected when the app re-runs.
Need help? Got a burning question or a spark of genius to share? Just open an issue in this repository.