MCPcopy
hub / github.com/docker/genai-stack / render_page

Function render_page

loader.py:118–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117
118def render_page():
119 datamodel_image = Image.open("./images/datamodel.png")
120 st.header("StackOverflow Loader")
121 st.subheader("Choose StackOverflow tags to load into Neo4j")
122 st.caption("Go to http://localhost:7474/ to explore the graph.")
123
124 user_input = get_tag()
125 num_pages, start_page = get_pages()
126
127 if st.button("Import", type="primary"):
128 with st.spinner("Loading... This might take a minute or two."):
129 try:
130 for page in range(1, num_pages + 1):
131 load_so_data(user_input, start_page + (page - 1))
132 st.success("Import successful", icon="✅")
133 st.caption("Data model")
134 st.image(datamodel_image)
135 st.caption("Go to http://localhost:7474/ to interact with the database")
136 except Exception as e:
137 st.error(f"Error: {e}", icon="🚨")
138 with st.expander("Highly ranked questions rather than tags?"):
139 if st.button("Import highly ranked questions"):
140 with st.spinner("Loading... This might take a minute or two."):
141 try:
142 load_high_score_so_data()
143 st.success("Import successful", icon="✅")
144 except Exception as e:
145 st.error(f"Error: {e}", icon="🚨")
146
147
148render_page()

Callers 1

loader.pyFile · 0.85

Calls 4

get_tagFunction · 0.85
get_pagesFunction · 0.85
load_so_dataFunction · 0.85
load_high_score_so_dataFunction · 0.85

Tested by

no test coverage detected