Skip to content

Commit f5d6780

Browse files
authored
UI Updates (#19)
* graphgpt feature added * Working sample loaders + neo4j uploader
1 parent 9ac12ce commit f5d6780

19 files changed

+1517
-719
lines changed

Pipfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ name = "pypi"
77
streamlit-player = "*"
88
graph-data-generator = "*"
99
streamlit-extras = "*"
10+
neo4j-uploader = "*"
1011

1112
[dev-packages]
1213

Pipfile.lock

+245-216
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,18 @@ Applet with Streamlit UI interface to conveniently use and test the graph-data-g
55
This applet uses [Poetry](https://python-poetry.org) for dependency management.
66

77
## Running
8-
`poetry update`
9-
`poetry run streamlit run graph_data_generator_streamlit/app.py`
8+
```
9+
poetry update
10+
poetry run streamlit run graph_data_generator_streamlit/app.py
11+
```
12+
13+
or
14+
15+
```
16+
pipenv shell
17+
pipenv sync
18+
pipenv run streamlit run graph_data_generator_streamlit/app.py
19+
```
20+
21+
## Testing with local packages
22+
`poetry add --editable /path/to/package`

graph_data_generator_streamlit/app.py

+60-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,72 @@
11
import streamlit as st
2-
from tabs.instructions_tab import instructions_tab
3-
from tabs.design_tab import design_tab
4-
from tabs.generate_tab import generate_tab
5-
from tabs.data_importer_tab import data_importer_tab
2+
from ui.instructions_ui import instructions_ui
3+
from ui.generate_ui import generate_ui
4+
from ui.config_ui import config_ui
5+
from ui.design_ui import arrows_ui, generators_ui
6+
from ui.ideate_ui import ideate_ui
7+
from ui.export_ui import export_ui
68
import logging
7-
import sys
89

910
# SETUP
10-
st.set_page_config(layout="wide")
11+
st.set_page_config(layout="wide",initial_sidebar_state='collapsed')
1112
logging.getLogger().setLevel(logging.DEBUG)
1213
logging.info(f'App Started')
1314

14-
instructions_tab()
15+
# LOAD any env
16+
neo4j_uri = st.secrets.get("NEO4J_URI", None)
17+
if "NEO4J_URI" not in st.session_state:
18+
st.session_state["NEO4J_URI"] = neo4j_uri
19+
neo4j_user = st.secrets.get("NEO4J_USER", None)
20+
if "NEO4J_USER" not in st.session_state:
21+
st.session_state["NEO4J_USER"] = neo4j_user
22+
password = st.secrets.get("NEO4J_PASSWORD", None)
23+
if "NEO4J_PASSWORD" not in st.session_state:
24+
st.session_state["NEO4J_PASSWORD"] = password
25+
open_ai_key = st.secrets.get("OPENAI_API_KEY", None)
26+
if "OPENAI_API_KEY" not in st.session_state:
27+
st.session_state["OPENAI_API_KEY"] = open_ai_key
1528

16-
st.markdown("-------------")
29+
# Setup other state info
30+
if "SAMPLE_PROMPT" not in st.session_state:
31+
st.session_state["SAMPLE_PROMPT"] = None
32+
if "DOWNLOADING" not in st.session_state:
33+
st.session_state["DOWNLOADING"] = False
34+
if "UPLOADING" not in st.session_state:
35+
st.session_state["UPLOADING"] = False
36+
if "ARROWS_DICT" not in st.session_state:
37+
st.session_state["ARROWS_DICT"] = None
38+
if "JSON_CONFIG" not in st.session_state:
39+
st.session_state["JSON_CONFIG"] = None
40+
41+
42+
# Header
43+
instructions_ui()
44+
45+
# Modify CSS to keep buttons closer together
46+
# st.markdown("""
47+
# <style>
48+
# div[data-testid="column"] {
49+
# width: fit-content !important;
50+
# flex: unset;
51+
# }
52+
# div[data-testid="column"] * {
53+
# width: fit-content !important;
54+
# }
55+
# </style>
56+
# """, unsafe_allow_html=True)
57+
58+
# Body
1759
st.markdown("**① DESIGN**")
18-
design_tab()
60+
with st.expander("GraphGPT"):
61+
ideate_ui()
62+
with st.expander("Arrows"):
63+
arrows_ui()
1964

20-
st.markdown("-------------")
2165
st.markdown("**② GENERATE**")
22-
generate_tab()
66+
generate_ui()
67+
68+
export_ui()
2369

24-
st.markdown("-------------")
25-
st.markdown("**③ IMPORT**")
26-
data_importer_tab()
70+
# Side bar
71+
with st.sidebar:
72+
generators_ui()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"graph": {
3+
"style": {
4+
"font-family": "sans-serif",
5+
"background-color": "#ffffff",
6+
"background-image": "",
7+
"background-size": "100%",
8+
"node-color": "#ffffff",
9+
"border-width": 4,
10+
"border-color": "#000000",
11+
"radius": 50,
12+
"node-padding": 5,
13+
"node-margin": 2,
14+
"outside-position": "auto",
15+
"node-icon-image": "",
16+
"node-background-image": "",
17+
"icon-position": "inside",
18+
"icon-size": 64,
19+
"caption-position": "inside",
20+
"caption-max-width": 200,
21+
"caption-color": "#000000",
22+
"caption-font-size": 50,
23+
"caption-font-weight": "normal",
24+
"label-position": "inside",
25+
"label-display": "pill",
26+
"label-color": "#000000",
27+
"label-background-color": "#ffffff",
28+
"label-border-color": "#000000",
29+
"label-border-width": 4,
30+
"label-font-size": 40,
31+
"label-padding": 5,
32+
"label-margin": 4,
33+
"directionality": "directed",
34+
"detail-position": "inline",
35+
"detail-orientation": "parallel",
36+
"arrow-width": 5,
37+
"arrow-color": "#000000",
38+
"margin-start": 5,
39+
"margin-end": 5,
40+
"margin-peer": 20,
41+
"attachment-start": "normal",
42+
"attachment-end": "normal",
43+
"relationship-icon-image": "",
44+
"type-color": "#000000",
45+
"type-background-color": "#ffffff",
46+
"type-border-color": "#000000",
47+
"type-border-width": 0,
48+
"type-font-size": 16,
49+
"type-padding": 5,
50+
"property-position": "outside",
51+
"property-alignment": "colon",
52+
"property-color": "#000000",
53+
"property-font-size": 16,
54+
"property-font-weight": "normal"
55+
},
56+
"nodes": [
57+
{
58+
"id": "n0",
59+
"position": {
60+
"x": 4.4720906200358924e-32,
61+
"y": -56.18953850390744
62+
},
63+
"caption": "Note",
64+
"style": {},
65+
"labels": [],
66+
"properties": {}
67+
},
68+
{
69+
"id": "n2",
70+
"position": {
71+
"x": -328.1388446141116,
72+
"y": 91.26151176562271
73+
},
74+
"caption": "Notebook",
75+
"style": {},
76+
"labels": [],
77+
"properties": {}
78+
},
79+
{
80+
"id": "n3",
81+
"position": {
82+
"x": 4.4720906200358924e-32,
83+
"y": 238.7125620351528
84+
},
85+
"caption": "Note",
86+
"style": {},
87+
"labels": [],
88+
"properties": {}
89+
}
90+
],
91+
"relationships": [
92+
{
93+
"id": "n1",
94+
"type": "CONTAINS",
95+
"style": {},
96+
"properties": {},
97+
"fromId": "n2",
98+
"toId": "n0"
99+
},
100+
{
101+
"id": "n2",
102+
"type": "CONTAINS",
103+
"style": {},
104+
"properties": {},
105+
"fromId": "n2",
106+
"toId": "n3"
107+
},
108+
{
109+
"id": "n3",
110+
"type": "LINKS_TO",
111+
"style": {},
112+
"properties": {},
113+
"fromId": "n0",
114+
"toId": "n3"
115+
}
116+
]
117+
},
118+
"diagramName": "EvernoteGraph"
119+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"nodes": [
3+
{
4+
"id": "n0",
5+
"position": {
6+
"x": -41.66856095418268,
7+
"y": -563.8057251425922
8+
},
9+
"caption": "Person",
10+
"style": {},
11+
"labels": [],
12+
"properties": {
13+
"first_name": "\"{\\\"first_name\\\": []}\","
14+
}
15+
},
16+
{
17+
"id": "n1",
18+
"position": {
19+
"x": 337.88984975524227,
20+
"y": -563.8057251425922
21+
},
22+
"caption": "Event",
23+
"style": {},
24+
"labels": [],
25+
"properties": {
26+
"name": "string"
27+
}
28+
}
29+
],
30+
"relationships": [
31+
{
32+
"id": "n0",
33+
"type": "ATTENDS",
34+
"style": {},
35+
"properties": {},
36+
"fromId": "n0",
37+
"toId": "n1"
38+
}
39+
]
40+
}

0 commit comments

Comments
 (0)