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
Copy file name to clipboardExpand all lines: notebooks/GenAI/embedding_demos/readme.md
+12-22Lines changed: 12 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,8 +21,8 @@ The Azure OpenAI Demo w/ Streamlit Frontend is designed to host various demonstr
21
21
- Learn the roles and functionalities of `Demo_Suite.py` and the `AI_Search_Query.py`, and `AOAI_Embeddings.py` pages.
22
22
3.**Generate and Query Embeddings**:
23
23
- Create and query text embeddings using the Azure OpenAI SDK.
24
-
4.**Use Ngrok with Azure ML**:
25
-
- Set up Ngrok to securely run the demo on Azure ML or a VM.
24
+
4.**Use Azure VM (NIH only) vs VScode **:
25
+
- Set up Streamlit to securely run the demo on Azure VM.
26
26
5.**Setup Development Environment**:
27
27
- Create a virtual environment, install dependencies, and configure environment variables.
28
28
- Execute the Streamlit demo locally and in cloud environments.
@@ -92,20 +92,11 @@ In this phase, you will choose your preferred environment to execute the Azure O
92
92
+[Executing via VsCode](#executing_via_vscode)
93
93
94
94
### Executing via Azure ML or VM <aname="executing_via_azure_ml_vm"></a>
95
-
Streamlit's native behavior expects to run applications locally on port 8501, which isn't possible when executing this demo from Azure ML or a VM. **Ngrok** is a tool that creates a secure tunnel to expose a local server to the internet. By using Ngrok, you can securely expose the Streamlit demo app running on Azure ML or a VM to the internet, bypassing the limitation of needing to run it on the local port 8501. This ensures that you can access and interact with the Streamlit application without needing to run from your local machine.
95
+
If you are in the NIH environment Streamlit's native behavior expects to run applications locally on port 8501, which isn't possible when executing this demo from Azure VM.
96
96
97
-
**Phase 1 - Obtain a free Ngrok Authtoken:**
98
-
99
-
1. Visit the Ngrok website: https://ngrok.com.
100
-
2. Click on the "Sign Up" button at the top right corner.
101
-
3. Sign up using your email address and create a password, or use your GitHub account.
102
-
4. Check your email for a verification message from Ngrok.
103
-
5. Click the verification link in the email to activate your account.
104
-
6. Log in to your Ngrok account.
105
-
7. Once logged in, you will be taken to your dashboard.
106
-
8. In your dashboard, find and copy your authentication (Authtoken) token. This token will be used for the `ngrok_key` variable in step 2.
97
+
Inorder to connect to the streamlit you must change the **port to 3389**. This is an approved port and will ensure that you can access and interact with the Streamlit application without needing to run from your local machine.
107
98
108
-
**Phase 2 - Create a .env file:**
99
+
**Phase 1 - Create a .env file:**
109
100
110
101
**Note:** If you have followed the steps in the [ARM Deployment tutorial](../azure_infra_setup/README.md) you have already created this file with its variables and can skip to the next section.
111
102
@@ -130,7 +121,6 @@ Streamlit's native behavior expects to run applications locally on port 8501, wh
130
121
AZURE_SEARCH_INDEX = "documents-index"# The index name 'documents-index' is used as default in this demo
131
122
BLOB_CONTAINER_NAME = "Your Azure Blob Container name hosting files from /search_documents"
@@ -141,7 +131,7 @@ Streamlit's native behavior expects to run applications locally on port 8501, wh
141
131
cat .env
142
132
```
143
133
144
-
**Phase 3 - Configure the virtual environment:**
134
+
**Phase 2 - Configure the virtual environment:**
145
135
1. If not already in***/GenAI***, navigate there by:
146
136
```bash
147
137
cd ./notebooks/GenAI
@@ -161,17 +151,17 @@ Streamlit's native behavior expects to run applications locally on port 8501, wh
161
151
pip install -r requirements.txt
162
152
```
163
153
164
-
**Phase 4 - Execute the Streamlit demo:**
154
+
**Phase 3 - Execute the Streamlit demo:**
165
155
1. Navigate to the /embeddings directory (location of the Streamlit demo):
166
156
```bash
167
157
cd ./embedding_demos
168
158
```
169
159
2. Execute the Streamlit demo:
170
-
- Run the [Demo_Suite_ngrok.py](./Demo_Suite_ngrok.py) file. This file will generate the secure Ngrok tunnel to access the Streamlit app. You do not need to run the `Demo_Suite.py` file.
171
-
```bash
172
-
python Demo_Suite_ngrok.py
160
+
- Run the [Demo_Suite.py](./Demo_Suite.py) file.
161
+
```sh
162
+
streamlit run Demo_Suite.py --server.port 3389
173
163
```
174
-
***Note: Access the Streamlit site from the provided URL in the terminal.***
164
+
***Note: Access the Streamlit site from the provided `External URL`in the terminal.***
@@ -234,7 +224,7 @@ To excute this demo, be sure to complete the following steps:
234
224
```
235
225
236
226
## Conclusion <a name="conclusion"></a>
237
-
By completing the "Azure OpenAI Demo w/ Streamlit Frontend" tutorial, you have gained valuable hands-on experience in integrating Azure OpenAI services with a Streamlit frontend. You have learned how to set up and configure essential components, including Azure OpenAI, Azure AI Search, and Azure Blob Storage. Additionally, you have explored the functionalities of key scripts and understood how to generate and query embeddings for interactive applications. This tutorial also guided you through executing the demo both on Azure ML using Ngrok and locally using VSCode, ensuring you are equipped to handle different deployment scenarios. We hope this tutorial has been informative and empowers you to leverage Azure OpenAI and Streamlit for your future projects.
227
+
By completing the "Azure OpenAI Demo w/ Streamlit Frontend" tutorial, you have gained valuable hands-on experience in integrating Azure OpenAI services with a Streamlit frontend. You have learned how to set up and configure essential components, including Azure OpenAI, Azure AI Search, and Azure Blob Storage. Additionally, you have explored the functionalities of key scripts and understood how to generate and query embeddings for interactive applications. This tutorial also guided you through executing the demo both on Azure VM and locally using VSCode, ensuring you are equipped to handle different deployment scenarios. We hope this tutorial has been informative and empowers you to leverage Azure OpenAI and Streamlit for your future projects.
238
228
239
229
## Clean Up <a name="clean_up"></a>
240
230
Make sure to shut down your Azure ML compute and if desired you can delete your Azure AI Search service, Azure Blob Storage Account, and Azure OpenAI service. ***Note these services can be used in other tutorials in this notebook.***
0 commit comments