Update app.py
Browse files
app.py
CHANGED
|
@@ -125,10 +125,14 @@ def get_tree(imgpath):
|
|
| 125 |
# fig = go.Figure(data=[edge_trace, node_trace], layout=layout)
|
| 126 |
# return fig
|
| 127 |
|
| 128 |
-
|
|
|
|
|
|
|
| 129 |
nodes = []
|
| 130 |
edges = []
|
| 131 |
positions = {}
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def traverse(node, depth=0, index=0):
|
| 134 |
# This assigns a unique index to each node, which we can use for positioning
|
|
@@ -201,10 +205,10 @@ def get_image(nodename, protoID):
|
|
| 201 |
with gr.Blocks() as demo:
|
| 202 |
|
| 203 |
imgpath = species_to_imgpath['bird']
|
| 204 |
-
|
| 205 |
gr.Markdown("## Interactive Tree and Image Display")
|
| 206 |
with gr.Row():
|
| 207 |
-
tree_output = gr.Plot(display_tree
|
| 208 |
|
| 209 |
with gr.Row():
|
| 210 |
with gr.Column():
|
|
|
|
| 125 |
# fig = go.Figure(data=[edge_trace, node_trace], layout=layout)
|
| 126 |
# return fig
|
| 127 |
|
| 128 |
+
ROOT = None
|
| 129 |
+
|
| 130 |
+
def display_tree():
|
| 131 |
nodes = []
|
| 132 |
edges = []
|
| 133 |
positions = {}
|
| 134 |
+
|
| 135 |
+
root = ROOT
|
| 136 |
|
| 137 |
def traverse(node, depth=0, index=0):
|
| 138 |
# This assigns a unique index to each node, which we can use for positioning
|
|
|
|
| 205 |
with gr.Blocks() as demo:
|
| 206 |
|
| 207 |
imgpath = species_to_imgpath['bird']
|
| 208 |
+
ROOT = get_tree(imgpath)
|
| 209 |
gr.Markdown("## Interactive Tree and Image Display")
|
| 210 |
with gr.Row():
|
| 211 |
+
tree_output = gr.Plot(display_tree) # Connect the function directly
|
| 212 |
|
| 213 |
with gr.Row():
|
| 214 |
with gr.Column():
|