|
|
|
@ -55,14 +55,14 @@ def find_columns(column, columns): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set oage config and CSS. |
|
|
|
# Set oage config and CSS. |
|
|
|
st.set_page_config(page_title='CSV→GEXF', page_icon='🎭') |
|
|
|
st.set_page_config(page_title='CSV→Gephi', page_icon='🎭') |
|
|
|
st.markdown(info.css, unsafe_allow_html=True) |
|
|
|
st.markdown(info.css, unsafe_allow_html=True) |
|
|
|
# Print title. |
|
|
|
# Print title. |
|
|
|
st.title("Make :green[GEXF] from :red[CSV]") |
|
|
|
st.title("Make :green[Gephi] from :red[CSV]") |
|
|
|
|
|
|
|
|
|
|
|
# Print tagline. |
|
|
|
# Print tagline. |
|
|
|
st.markdown( |
|
|
|
st.markdown( |
|
|
|
"""*Upload your data as CSV to make it into a gexf-file compatible |
|
|
|
"""*Upload your data as CSV to make it into a GraphML-file compatible |
|
|
|
with Gephi and [Gephi Light](https://gephi.org/gephi-lite/).*""" |
|
|
|
with Gephi and [Gephi Light](https://gephi.org/gephi-lite/).*""" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@ -80,7 +80,7 @@ csv_nodes = st.file_uploader( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Ask for relations file. |
|
|
|
# Ask for relations file. |
|
|
|
csv_edges = st.file_uploader(label="Upload file with **relations**.", key="relations", help=f'[Example]({info.relations_example})') |
|
|
|
csv_edges = st.file_uploader(label="Upload file with **edges/relations**.", key="relations", help=f'[Example]({info.relations_example})') |
|
|
|
|
|
|
|
|
|
|
|
col1, col2 = st.columns([1,2]) |
|
|
|
col1, col2 = st.columns([1,2]) |
|
|
|
|
|
|
|
|
|
|
|
@ -184,12 +184,12 @@ if files_uploaded or 'files_already_uploaded' in st.session_state: |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Turn the graph into a string. |
|
|
|
# Turn the graph into a string. |
|
|
|
graph_text = "\n".join([line for line in nx.generate_gexf(G)]) |
|
|
|
graph_text = "\n".join([line for line in nx.generate_graphml(G)]) |
|
|
|
|
|
|
|
|
|
|
|
# Download gexf-file. |
|
|
|
# Download graphml-file. |
|
|
|
gexf_file = "output.gexf" |
|
|
|
graphml_file = "output.graphml" |
|
|
|
st.download_button( |
|
|
|
st.download_button( |
|
|
|
"Download gexf-file", graph_text, file_name=gexf_file |
|
|
|
"Download grampml-file", graph_text, file_name=graphml_file |
|
|
|
) |
|
|
|
) |
|
|
|
st.write('Import the file to Gephi/Gephi Light, or try [Gephisto](https://jacomyma.github.io/gephisto/) to get an idea of the network.') |
|
|
|
st.write('Import the file to Gephi/Gephi Light, or try [Gephisto](https://jacomyma.github.io/gephisto/) to get an idea of the network.') |
|
|
|
|
|
|
|
|
|
|
|
|