awacke1 commited on
Commit
644ca8a
1 Parent(s): fd0bb38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -1,15 +1,21 @@
1
  import streamlit as st
 
2
  from azure.cosmos import CosmosClient, PartitionKey
3
  from azure.storage.blob import BlobServiceClient
4
  import requests
5
  from azure.identity import DefaultAzureCredential
6
 
7
- # Initialize Azure Cosmos DB Client and Blob Service Client
8
- from azure.cosmos import AzureKeyCredential
9
- account_url = "https://your-account-name.documents.azure.com:443/" # Replace with your Cosmos account URL
10
- account_key = "your-account-key" # Replace with your Cosmos account key
11
- cosmos_client = CosmosClient(account_url, credential=AzureKeyCredential(account_key))
12
- blob_service = BlobServiceClient.from_connection_string('<your_blob_storage_connection_string>')
 
 
 
 
 
13
 
14
  # Streamlit UI
15
  st.title('Azure Services Integration with Streamlit')
 
1
  import streamlit as st
2
+ import os
3
  from azure.cosmos import CosmosClient, PartitionKey
4
  from azure.storage.blob import BlobServiceClient
5
  import requests
6
  from azure.identity import DefaultAzureCredential
7
 
8
+ # Environment Variables
9
+ COSMOS_ACCOUNT_URL = os.getenv('COSMOS_ACCOUNT_URL')
10
+ COSMOS_ACCOUNT_KEY = os.getenv('COSMOS_ACCOUNT_KEY')
11
+ BLOB_STORAGE_CONNECTION_STRING = os.getenv('BLOB_STORAGE_CONNECTION_STRING')
12
+
13
+ # Initialize Azure Cosmos DB Client
14
+ cosmos_client = CosmosClient(COSMOS_ACCOUNT_URL, credential=DefaultAzureCredential())
15
+
16
+ # Initialize Azure Blob Storage Client
17
+ blob_service = BlobServiceClient.from_connection_string(BLOB_STORAGE_CONNECTION_STRING)
18
+
19
 
20
  # Streamlit UI
21
  st.title('Azure Services Integration with Streamlit')