You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deployed Streamlit apps live here in the streamlit_demo_apps folder.
3
+
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.
4
4
5
5
## How to add a new Streamlit App
6
6
7
-
### 0. Create a streamlit secrets file and add your nilchain private key within `.streamlit/secrets.toml`
7
+
### 0. Fork this repo
8
+
9
+
### 1. Create a streamlit secrets file
10
+
11
+
Run this command to create a `.streamlit/secrets.toml` copied from the example.
### 1. Create an app file in the streamlit_demo_apps folder
14
-
15
-
Check out the addition app file example:
17
+
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
16
18
17
-
`app_addition.py`
19
+
### 2. Run the script to generate a new streamlit app for your program
18
20
19
-
### 2. Copy the compiled Nada program files from the target/ folder into the streamlit_demo_apps/compiled_nada_programs folder
21
+
From the root folder of this repo, run the generate-streamlit-app script:
20
22
21
-
Check out the compiled Nada program files for addition:
22
-
23
-
nada binary `addition.nada.bin`
24
-
nada json `addition.nada.json`
23
+
```
24
+
python3 generate-streamlit-app.py
25
+
```
25
26
26
-
### 3. Update your app file with the corresponding program name and program test name
27
+
### 3. Follow the prompts to
27
28
28
-
Check out the addition app file example:
29
+
- Select an existing program (from the src/ directory)
30
+
- Select an existing yaml test file for your program (from the tests/ directory)
29
31
30
-
`app_addition.py`
32
+
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
31
33
32
34
```
33
-
program_name = 'addition'
34
-
program_test_name = 'addition_test'
35
+
streamlit run streamlit_demo_apps/app_[your_program_name].py`
35
36
```
36
37
37
38
### 4. Test your Streamlit app locally
38
39
39
-
Make sure the apps will work when deployed by testing this command from the root folder.
40
+
View the app in your browser to make sure everything works as expected.
41
+
42
+
### 5. Commit your code to GitHub
43
+
44
+
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.)
40
45
41
46
```
42
-
streamlit run streamlit_demo_apps/[app_file_name].py
47
+
git add .
48
+
git commit -m "my new streamlit nillion app"
49
+
git push origin main
43
50
```
44
51
45
-
For example to make sure the addition app will work when deployed, run
52
+
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.
53
+
54
+
<imgwidth="1000"alt="Streamlit Community Cloud"src="https://github.com/user-attachments/assets/74a70b4e-506c-41df-8d59-f949871c9a4e">
55
+
56
+
### 6. Deploy your app from Streamlit.io
57
+
58
+
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`
#### Add your Nilchain Private Key using Advanced Settings > Secrets
63
+
64
+
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:
0 commit comments