Skip to content

Commit

Permalink
update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
oceans404 committed Oct 10, 2024
1 parent dc100d3 commit 5f4d9ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 12 additions & 11 deletions streamlit_demo_apps/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -14,30 +16,30 @@ 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:

```
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.)

Expand All @@ -51,8 +53,7 @@ Once you've committed the open source code, you can click the "deploy" button wi

<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
### 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`

Expand All @@ -68,9 +69,9 @@ nilchain_private_key = "YOUR_FUNDED_PRIVATE_KEY"

<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.
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!

Expand Down

0 comments on commit 5f4d9ef

Please sign in to comment.