From 5f4d9efa1faa21176bbf2a1c45ca4957c20bb68d Mon Sep 17 00:00:00 2001 From: oceans404 Date: Thu, 10 Oct 2024 10:50:27 -0700 Subject: [PATCH] update based on feedback --- streamlit_app.py | 3 ++- streamlit_demo_apps/README.md | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 80ac5ab..d13ddb1 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -186,7 +186,8 @@ def main(nada_test_file_name=None, path_nada_bin=None, path_nada_json=None): # Display the program code st.subheader(f"{program_name}.py") - st.code(program_code, language='python') + with st.expander(f"Nada Program: {program_name}"): + st.code(program_code, language='python') # Display inputs grouped by party, alphabetized updated_input_values = create_party_inputs(input_info, input_values) diff --git a/streamlit_demo_apps/README.md b/streamlit_demo_apps/README.md index cb8ee1c..c490471 100644 --- a/streamlit_demo_apps/README.md +++ b/streamlit_demo_apps/README.md @@ -1,10 +1,12 @@ # Deploying Streamlit Apps -Follow the steps to deploy a live Streamlit app for your Nada program and test file. 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. +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. ## How to add a new Streamlit App -### 0. Create a streamlit secrets file +### 0. Fork this repo + +### 1. Create a streamlit secrets file Run this command to create a `.streamlit/secrets.toml` copied from the example. @@ -14,7 +16,7 @@ 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 +### 2. 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: @@ -22,22 +24,22 @@ From the root folder of this repo, run the generate-streamlit-app script: python3 generate-streamlit-app.py ``` -### 2. Follow the prompts to +### 3. Follow the prompts to - Select an existing program (from the src/ directory) - Select an existing yaml test file for your program (from the tests/ directory) -This will generate a Streamlit app file: streamlit_demo_apps/app_[your_program_name].py. The script will run the Streamlit app locally with this command +This will generate a Streamlit app file: streamlit*demo_apps/app*[your_program_name].py. The script will run the Streamlit app locally with this command ``` streamlit run streamlit_demo_apps/app_[your_program_name].py` ``` -### 3. Test your Streamlit app locally +### 4. Test your Streamlit app locally View the app in your browser to make sure everything works as expected. -### 4. Commit your code to GitHub +### 5. 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.) @@ -51,8 +53,7 @@ Once you've committed the open source code, you can click the "deploy" button wi Streamlit Community Cloud - -### 5. Deploy your app from Streamlit.io +### 6. 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` @@ -68,9 +69,9 @@ nilchain_private_key = "YOUR_FUNDED_PRIVATE_KEY" advanced settings -Save and click "Deploy" to deploy your testnet-connected Streamlit app. +Save and click "Deploy" to deploy your testnet-connected Streamlit app. -### 6. Access Your Live Streamlit App +### 7. Access Your Live Streamlit App Once deployed, you’ll get a live link to your Nillion Testnet Streamlit app!