Update app.py
Browse files
app.py
CHANGED
|
@@ -56,7 +56,8 @@ def generate_concept_map(json_input: str) -> str:
|
|
| 56 |
graph_attr={
|
| 57 |
'rankdir': 'TB', # Top-to-Bottom
|
| 58 |
'splines': 'ortho', # Straight lines
|
| 59 |
-
'bgcolor': 'white' # Fondo blanco
|
|
|
|
| 60 |
}
|
| 61 |
)
|
| 62 |
|
|
@@ -77,12 +78,6 @@ def generate_concept_map(json_input: str) -> str:
|
|
| 77 |
# Helper function to recursively add nodes and edges
|
| 78 |
def add_nodes_and_edges(parent_id, nodes_list, current_depth=0):
|
| 79 |
# Calculate color for current depth, making it lighter
|
| 80 |
-
# We'll blend towards white based on depth
|
| 81 |
-
# Max depth in your example is 5 (central + 4 levels of nodes)
|
| 82 |
-
# We want colors to get lighter as depth increases
|
| 83 |
-
|
| 84 |
-
# Simple linear interpolation for color lightening
|
| 85 |
-
# You can adjust the lightening factor (e.g., 0.15)
|
| 86 |
lightening_factor = 0.12 # How much lighter each level gets
|
| 87 |
|
| 88 |
# Convert base_color hex to RGB
|
|
@@ -91,7 +86,6 @@ def generate_concept_map(json_input: str) -> str:
|
|
| 91 |
base_b = int(base_color[5:7], 16)
|
| 92 |
|
| 93 |
# Calculate current node color
|
| 94 |
-
# Target is white (255, 255, 255)
|
| 95 |
current_r = base_r + int((255 - base_r) * current_depth * lightening_factor)
|
| 96 |
current_g = base_g + int((255 - base_g) * current_depth * lightening_factor)
|
| 97 |
current_b = base_b + int((255 - base_b) * current_depth * lightening_factor)
|
|
|
|
| 56 |
graph_attr={
|
| 57 |
'rankdir': 'TB', # Top-to-Bottom
|
| 58 |
'splines': 'ortho', # Straight lines
|
| 59 |
+
'bgcolor': 'white', # Fondo blanco
|
| 60 |
+
'pad': '0.5' # ¡Este es el margen! 0.5 pulgadas
|
| 61 |
}
|
| 62 |
)
|
| 63 |
|
|
|
|
| 78 |
# Helper function to recursively add nodes and edges
|
| 79 |
def add_nodes_and_edges(parent_id, nodes_list, current_depth=0):
|
| 80 |
# Calculate color for current depth, making it lighter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
lightening_factor = 0.12 # How much lighter each level gets
|
| 82 |
|
| 83 |
# Convert base_color hex to RGB
|
|
|
|
| 86 |
base_b = int(base_color[5:7], 16)
|
| 87 |
|
| 88 |
# Calculate current node color
|
|
|
|
| 89 |
current_r = base_r + int((255 - base_r) * current_depth * lightening_factor)
|
| 90 |
current_g = base_g + int((255 - base_g) * current_depth * lightening_factor)
|
| 91 |
current_b = base_b + int((255 - base_b) * current_depth * lightening_factor)
|