ceckenrode commited on
Commit
fa3bacb
·
1 Parent(s): 6ebab22

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +146 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from graphviz import Digraph
3
+
4
+
5
+ st.markdown("""
6
+ Prompt:
7
+ Create an interactive streamlit graph builder using the graphviz diagram model language and the streamlit feature: st.graphviz_chart(figure_or_dot, use_container_width=False) to show an azure cloud architecture model including the top ten architecture components for python full stack development for web, api, ml, models, datasets torch, transformers, streamlit, azure docker and kubernetes pods for scaling
8
+
9
+ """)
10
+
11
+ # Dot demo:
12
+ import streamlit as st
13
+
14
+ # Define the default graphviz DOT string
15
+ default_dot = """
16
+ digraph G {
17
+ rankdir=LR
18
+ node [shape=box]
19
+ WebApp -> API
20
+ API -> Models
21
+ API -> Datasets
22
+ Models -> Torch
23
+ Models -> Transformers
24
+ WebApp -> Streamlit
25
+ Streamlit -> Azure
26
+ Azure -> Docker
27
+ Azure -> Kubernetes
28
+ }
29
+ """
30
+
31
+ # Define the list of top 10 components
32
+ components = [
33
+ "WebApp",
34
+ "API",
35
+ "Models",
36
+ "Datasets",
37
+ "Torch",
38
+ "Transformers",
39
+ "Streamlit",
40
+ "Azure",
41
+ "Docker",
42
+ "Kubernetes",
43
+ ]
44
+
45
+ # Define a dictionary to map component names to DOT node IDs
46
+ node_ids = {
47
+ component: component.lower()
48
+ for component in components
49
+ }
50
+
51
+ def build_dot_string(selected_components):
52
+ """Builds a DOT string representing the selected components"""
53
+ selected_nodes = [node_ids[component] for component in selected_components]
54
+ dot = """
55
+ digraph G {
56
+ rankdir=LR
57
+ node [shape=box]
58
+ """
59
+ for node in selected_nodes:
60
+ dot += f"{node} [color=blue]\n"
61
+ for i in range(len(selected_nodes)):
62
+ for j in range(i+1, len(selected_nodes)):
63
+ dot += f"{selected_nodes[i]} -> {selected_nodes[j]}\n"
64
+ dot += "}"
65
+ return dot
66
+
67
+ def main():
68
+ st.title("Azure Cloud Architecture Builder")
69
+
70
+ # Select the components
71
+ st.sidebar.title("Select components")
72
+ selected_components = st.sidebar.multiselect(
73
+ "Select the top 10 components",
74
+ components,
75
+ default=components[:3]
76
+ )
77
+
78
+ # Build the DOT string
79
+ dot = build_dot_string(selected_components)
80
+
81
+ # Render the graphviz chart
82
+ st.graphviz_chart(dot, use_container_width=True)
83
+
84
+ if __name__ == "__main__":
85
+ main()
86
+
87
+
88
+
89
+ # Initialize the graph
90
+ graph = Digraph(comment='Architectural Model')
91
+
92
+ # Add nodes to the graph
93
+ graph.node('data_layer', 'Data Layer')
94
+ graph.node('acr', 'Azure Container Registry')
95
+ graph.node('aks', 'Azure Kubernetes\n& Docker Container Pod\nwith Scalability')
96
+ graph.node('snowflake', 'Snowflake Instance')
97
+ graph.node('cosmos', 'Azure Cosmos\nDatabase')
98
+ graph.node('api', 'API Standard\n(using Uvicorn)')
99
+ graph.node('soar', 'SOAR Component\n(on Linux Python\nSlimbuster Docker)')
100
+
101
+ # Add edges to the graph
102
+ graph.edge('data_layer', 'acr')
103
+ graph.edge('acr', 'aks')
104
+ graph.edge('aks', 'snowflake')
105
+ graph.edge('aks', 'cosmos')
106
+ graph.edge('aks', 'api')
107
+ graph.edge('aks', 'soar')
108
+
109
+ # Define the Streamlit app
110
+ def app():
111
+ st.title('Architectural Model')
112
+
113
+ # Draw the graph
114
+ st.graphviz_chart(graph.source)
115
+
116
+ # Add buttons to customize the graph
117
+ if st.button('Hide Data Layer'):
118
+ graph.node('data_layer', style='invisible')
119
+
120
+ if st.button('Hide Snowflake Instance'):
121
+ graph.node('snowflake', style='invisible')
122
+
123
+ if st.button('Hide SOAR Component'):
124
+ graph.node('soar', style='invisible')
125
+
126
+
127
+
128
+ st.markdown("""
129
+ # QA Model Spaces:
130
+ QA use cases include QA, Semantic Document and FAQ Search.
131
+ 1. Streamlit Question Answering w Hugging Face: https://huggingface.co/spaces/awacke1/Question-answering
132
+ 2. Seq2Seq:
133
+ - https://huggingface.co/spaces/awacke1/4-Seq2SeqQAT5
134
+ - https://huggingface.co/spaces/awacke1/AW-04-GR-Seq-2-Seq-QA-Auto-Gen
135
+ 3. BioGPT: https://huggingface.co/spaces/awacke1/microsoft-BioGPT-Large-PubMedQA
136
+ 4. NLP QA Context: https://huggingface.co/spaces/awacke1/NLPContextQATransformersRobertaBaseSquad2
137
+ - https://huggingface.co/spaces/awacke1/SOTA-Plan
138
+ 5. https://huggingface.co/spaces/awacke1/Question-answering
139
+ 6. QA MLM: https://huggingface.co/spaces/awacke1/SOTA-MedEntity
140
+ """)
141
+
142
+
143
+
144
+ # Run the Streamlit app
145
+ if __name__ == '__main__':
146
+ app()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ graphviz