-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added script for turning any nada program and test into a streamlit app #36
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
315fada
auto creation of streamlit apps through script
oceans404 b8c03dc
use script to generate streamlit apps
oceans404 369c744
Update streamlit_demo_apps/README.md
oceans404 d388bcd
Update README.md
oceans404 d713769
Update streamlit_demo_apps/README.md
oceans404 9165079
Update README.md
oceans404 dc100d3
Update streamlit_demo_apps/README.md
oceans404 5f4d9ef
update based on feedback
oceans404 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
# Deploying Streamlit Apps | ||
|
||
To deploy Streamlit apps, they need to be written and committed to a public GitHub repository. | ||
This guide will show you how to quickly spin up a Nillion Testnet connected, live Streamlit app from our template using the simple generate-streamlit-app script. Once your app is ready, you can easily deploy it by pushing it to a public GitHub repo. Just follow these steps to get started: | ||
|
||
## How to add a new Streamlit App | ||
|
||
### 0. Create a streamlit secrets file and add your nilchain private key within `.streamlit/secrets.toml` | ||
### 0. Create a streamlit secrets file | ||
|
||
Run this command to create a `.streamlit/secrets.toml` copied from the example. | ||
|
||
``` | ||
cp .streamlit/secrets.toml.example .streamlit/secrets.toml | ||
``` | ||
|
||
Add your Nilchain private key to the .streamlit/secrets.toml file. The private key must be linked to a funded Nillion Testnet address that was created using a Google account (not a mnemonic). This allows you to retrieve the private key from Keplr. If you don’t have a Testnet wallet yet, you can learn how to create one here: https://docs.nillion.com/testnet-guides | ||
|
||
### 1. Run the script to generate a new streamlit app for your program | ||
|
||
From the root folder of this repo, run the generate-streamlit-app script: | ||
|
@@ -33,7 +37,7 @@ streamlit run streamlit_demo_apps/app_[your_program_name].py` | |
|
||
View the app in your browser to make sure everything works as expected. | ||
|
||
### 4. Deploy your app | ||
### 4. Commit your code to Github | ||
oceans404 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Add and commit your new streamlit app code to your forked Github repo. (Code must be connected to a remote, open source GitHub repository to deploy a Streamlit app.) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forking repo was not mentioned in the main repo README / here. Should we explicitly mention this higher in case? With my test - i cloned repo instead of forking it 😅 |
||
|
||
|
@@ -45,14 +49,29 @@ git push origin main | |
|
||
Once you've committed the open source code, you can click the "deploy" button within your local streamlit app. Sign in with Github and select the "Deploy Now" on Streamlit Community Cloud option to deploy the app for free. | ||
|
||
#### Deploy an app settings | ||
<img width="1000" alt="Streamlit Community Cloud" src="https://github.com/user-attachments/assets/74a70b4e-506c-41df-8d59-f949871c9a4e"> | ||
|
||
|
||
### 5. Deploy your app from Streamlit.io | ||
|
||
When you click "Deploy Now" from your local app, you'll be taken to streamlit.io and asked to log in with Github to create a new Streamlit app. Set the main file path to your new app `streamlit_demo_apps/app_[your_program_name].py` | ||
|
||
Set the main file path to your new app `streamlit_demo_apps/app_[your_program_name].py` | ||
<img width="1000" alt="streamlit settings" src="https://github.com/user-attachments/assets/e3821aa4-44b6-4f16-8400-97e531dfef23"> | ||
|
||
#### Add your Nilchain Private Key using Advanced Settings > Secrets | ||
|
||
Go to "Advanced settings" and in Secrets, copy in the contents of your .streamlit/secrets.toml file. At a minimum, make sure to add your secret private key: | ||
|
||
``` | ||
nilchain_private_key = "YOUR_FUNDED_PRIVATE_KEY" | ||
``` | ||
|
||
Save and click "Deploy" to deploy your testnet Streamlit app! | ||
<img width="1000" alt="advanced settings" src="https://github.com/user-attachments/assets/6b48b225-60b7-41bd-8591-c04419131bf8"> | ||
|
||
Save and click "Deploy" to deploy your testnet-connected Streamlit app. | ||
|
||
### 6. Access Your Live Streamlit App | ||
|
||
Once deployed, you’ll get a live link to your Nillion Testnet Streamlit app! | ||
|
||
Example live Streamlit App: https://stephs-nada-multiplication-app.streamlit.app/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reads a bit odd - but might be me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Follow the steps to deploy a live Streamlit app for your Nada program. The app will connect to the Nillion Testnet to store your Nada program, store secret inputs (or use computation time secrets), and run blind computation"