Update radial_diagram_generator.py
Browse files- radial_diagram_generator.py +59 -0
radial_diagram_generator.py
CHANGED
@@ -7,6 +7,65 @@ from graph_generator_utils import add_nodes_and_edges
|
|
7 |
def generate_radial_diagram(json_input: str) -> str:
|
8 |
"""
|
9 |
Generates a radial (center-expanded) diagram from JSON input.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
"""
|
11 |
try:
|
12 |
if not json_input.strip():
|
|
|
7 |
def generate_radial_diagram(json_input: str) -> str:
|
8 |
"""
|
9 |
Generates a radial (center-expanded) diagram from JSON input.
|
10 |
+
|
11 |
+
Args:
|
12 |
+
json_input (str): A JSON string describing the radial diagram structure.
|
13 |
+
It must follow the Expected JSON Format Example below.
|
14 |
+
|
15 |
+
Expected JSON Format Example:
|
16 |
+
{
|
17 |
+
"central_node": "AI Core Concepts & Domains",
|
18 |
+
"nodes": [
|
19 |
+
{
|
20 |
+
"id": "foundational_ml",
|
21 |
+
"label": "Foundational ML",
|
22 |
+
"relationship": "builds on",
|
23 |
+
"subnodes": [
|
24 |
+
{"id": "supervised_l", "label": "Supervised Learning", "relationship": "e.g."},
|
25 |
+
{"id": "unsupervised_l", "label": "Unsupervised Learning", "relationship": "e.g."}
|
26 |
+
]
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"id": "dl_architectures",
|
30 |
+
"label": "Deep Learning Arch.",
|
31 |
+
"relationship": "evolved from",
|
32 |
+
"subnodes": [
|
33 |
+
{"id": "cnns_rad", "label": "CNNs", "relationship": "e.g."},
|
34 |
+
{"id": "rnns_rad", "label": "RNNs", "relationship": "e.g."}
|
35 |
+
]
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"id": "major_applications",
|
39 |
+
"label": "Major AI Applications",
|
40 |
+
"relationship": "applied in",
|
41 |
+
"subnodes": [
|
42 |
+
{"id": "nlp_rad", "label": "Natural Language Processing", "relationship": "e.g."},
|
43 |
+
{"id": "cv_rad", "label": "Computer Vision", "relationship": "e.g."}
|
44 |
+
]
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"id": "ethical_concerns",
|
48 |
+
"label": "Ethical AI Concerns",
|
49 |
+
"relationship": "addresses",
|
50 |
+
"subnodes": [
|
51 |
+
{"id": "fairness_rad", "label": "Fairness & Bias", "relationship": "e.g."},
|
52 |
+
{"id": "explainability", "label": "Explainability (XAI)", "relationship": "e.g."}
|
53 |
+
]
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"id": "future_trends",
|
57 |
+
"label": "Future AI Trends",
|
58 |
+
"relationship": "looking at",
|
59 |
+
"subnodes": [
|
60 |
+
{"id": "agi_future", "label": "AGI Development", "relationship": "e.g."},
|
61 |
+
{"id": "quantum_ai", "label": "Quantum AI", "relationship": "e.g."}
|
62 |
+
]
|
63 |
+
}
|
64 |
+
]
|
65 |
+
}
|
66 |
+
|
67 |
+
Returns:
|
68 |
+
str: The filepath to the generated PNG image file.
|
69 |
"""
|
70 |
try:
|
71 |
if not json_input.strip():
|