()
| 116 | |
| 117 | |
| 118 | def 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 | |
| 148 | render_page() |
no test coverage detected