awacke1 commited on
Commit
df6a3e9
·
1 Parent(s): f19422d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -27
app.py CHANGED
@@ -1,35 +1,28 @@
1
  import streamlit as st
2
- from diagrams import Cluster, Diagram
3
- from diagrams.azure.compute import ContainerInstances
4
- from diagrams.azure.integration import APIManagement
5
- from diagrams.onprem.container import Docker
6
- #from diagrams.onprem.database import Snowflake
7
- from diagrams.programming.framework import FastAPI
8
- from diagrams.custom import Custom
9
 
10
- # Define the diagram
11
- def create_diagram():
12
- with Diagram("Architecture Diagram", show=False):
13
- with Cluster("Azure"):
14
- container_registry = ContainerInstances("Azure Container Registry")
15
- container_registry_api = APIManagement("ACR API")
16
 
17
- with Cluster("Docker"):
18
- docker = Docker("Docker")
19
- slimbuster = Custom("Slim Buster", "./slimbuster.png")
20
 
21
- with Cluster("Python"):
22
- python = FastAPI("Python / Uvicorn")
23
 
24
- #with Cluster("Snowflake"):
25
- # snowflake = Snowflake("Snowflake")
 
 
 
26
 
27
- container_registry >> docker >> slimbuster >> python
28
- container_registry_api >> docker
29
- python >> snowflake
30
 
31
- return "architecture_diagram.png"
 
 
 
32
 
33
- # Create and show the diagram in Streamlit
34
- diagram = create_diagram()
35
- st.image(diagram, caption="Architecture Diagram", use_column_width=True)
 
1
  import streamlit as st
2
+ from diagrams import Diagram, Cluster
3
+ from diagrams.azure.network import VirtualNetwork, LoadBalancer, TrafficManager
 
 
 
 
 
4
 
5
+ def main():
6
+ st.set_page_config(page_title="Azure Network Diagram Demo")
 
 
 
 
7
 
8
+ with st.sidebar:
9
+ st.title("Azure Network Diagram Demo")
 
10
 
11
+ with st.container():
12
+ st.header("Azure Network Diagram")
13
 
14
+ with Diagram("Azure Network Diagram", show=False):
15
+ with Cluster("Azure"):
16
+ vn = VirtualNetwork("Virtual Network")
17
+ lb = LoadBalancer("Load Balancer")
18
+ tm = TrafficManager("Traffic Manager")
19
 
20
+ vn >> lb >> tm
 
 
21
 
22
+ st.markdown("#### Legend")
23
+ st.markdown("- Virtual Network: A virtual network to isolate your Azure resources.")
24
+ st.markdown("- Load Balancer: A traffic distribution tool for Azure resources.")
25
+ st.markdown("- Traffic Manager: A DNS-based traffic routing service.")
26
 
27
+ if __name__ == '__main__':
28
+ main()