-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
Co-authored-by: Dimitris Mouris <[email protected]>
streamlit_demo_apps/README.md
Outdated
@@ -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: |
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.
a Nillion Testnet connected, live Streamlit app f
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"
Co-authored-by: Dimitris Mouris <[email protected]>
|
||
### 4. Commit your code to GitHub | ||
|
||
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 comment
The 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 😅
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.
LGTM - very simple and easy process to follow.
Took 2-3mins for me 👍
Co-authored-by: crypblizz <[email protected]>
streamlit_app.py
Outdated
@@ -156,32 +189,15 @@ def main(nada_test_file_name=None, path_nada_bin=None, path_nada_json=None): | |||
st.code(program_code, language='python') |
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.
st.code(program_code, language='python') | |
with st.expander(f"Nada Program: {program_name}"): | |
st.code(program_code, language='python') |
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.
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.
great point! will add this
Deploying Streamlit Apps with the generate-streamlit-app script
To deploy Streamlit apps, they need to be written and committed to a public Github repo.
How to add a new Streamlit App
0. Create a streamlit secrets file and add your nilchain private key within
.streamlit/secrets.toml
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:
2. Follow the prompts to
This will generate a Streamlit app file: streamlitdemo_apps/app[your_program_name].py. The script will run the Streamlit app locally with this command
3. Test your Streamlit app locally
View the app in your browser to make sure everything works as expected.
4. Deploy your app
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.)
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
Set the main file path to your new app
streamlit_demo_apps/app_[your_program_name].py
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:
Save and click "Deploy" to deploy your testnet Streamlit app!