def results(aoi: Vector) -> None: """ Controls the results elements. """ st.write("") _, col1, col2, _ = st.beta_columns((0.1, 1, 2, 0.1)) download_geojson = aoi.df.__geo_interface__ utils.download_button( json.dumps(download_geojson), "aoi.geojson", "Download as GeoJSON", col1, ) expander_result = col2.beta_expander("Click to expand - see full GeoJSON") expander_result.write(download_geojson)
trim_blocks=True, lstrip_blocks=True, ) template = env.get_template(f"classifier.py.jinja") code = template.render(header=utils.code_header, notebook=False, **inputs) notebook_code = template.render(header=utils.notebook_header, notebook=True, **inputs) notebook = utils.to_notebook(notebook_code) # Display donwload/open buttons. st.write("") # add vertical space col1, col2, col3 = st.beta_columns(3) open_colab = col1.button("🚀 Open in Colab") # logic handled further down with col2: utils.download_button(code, "code.py", "🐍 Download (.py)") with col3: utils.download_button(notebook, "notebook.ipynb", "📓 Download (.ipynb)") colab_error = st.empty() # Display code. # TODO: Think about writing Installs on extra line here. st.code(code) # Handle "Open Colab" button. Down here because to open the new web page, it # needs to create a temporary element, which we don't want to show above. if open_colab: if colab_enabled: """ Colab feature coming soon :)
lstrip_blocks=True, ) template = env.get_template("code-template.py.jinja") code = template.render(header=utils.code_header, notebook=False, **inputs) notebook_code = template.render(header=utils.notebook_header, notebook=True, **inputs) notebook = utils.to_notebook(notebook_code) # Display donwload/open buttons. # TODO: Maybe refactor this (with some of the stuff in utils.py) to buttons.py. st.write("") # add vertical space col1, col2, col3 = st.beta_columns(3) open_colab = col1.button("🚀 Open in Colab") # logic handled further down with col2: utils.download_button(code, "generated-code.py", "🐍 Download (.py)") with col3: utils.download_button(notebook, "generated-notebook.ipynb", "📓 Download (.ipynb)") colab_error = st.empty() # st.success( # "Enjoy this site? Leave a star on [the Github repo](https://github.com/jrieke/traingenerator) :)" # ) # Display code. # TODO: Think about writing Installs on extra line here. st.code(code) # Handle "Open Colab" button. Down here because to open the new web page, it # needs to create a temporary element, which we don't want to show above.