Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,11 @@ import gradio as gr
|
|
| 2 |
import igraph as ig
|
| 3 |
import plotly.graph_objects as go
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
def create_plotly_tree():
|
| 6 |
# Create an igraph tree
|
| 7 |
g = ig.Graph.Tree(7, 2) # Example tree
|
|
@@ -42,9 +47,11 @@ def create_plotly_tree():
|
|
| 42 |
|
| 43 |
return fig
|
| 44 |
|
|
|
|
|
|
|
| 45 |
def setup_interface():
|
| 46 |
iface = gr.Interface(
|
| 47 |
-
fn=
|
| 48 |
inputs=[],
|
| 49 |
outputs=gr.Plot(),
|
| 50 |
title="Interactive Tree Visualization"
|
|
|
|
| 2 |
import igraph as ig
|
| 3 |
import plotly.graph_objects as go
|
| 4 |
|
| 5 |
+
PLOTLY_TREE = None
|
| 6 |
+
|
| 7 |
+
def get_plotly_tree():
|
| 8 |
+
return PLOTLY_TREE
|
| 9 |
+
|
| 10 |
def create_plotly_tree():
|
| 11 |
# Create an igraph tree
|
| 12 |
g = ig.Graph.Tree(7, 2) # Example tree
|
|
|
|
| 47 |
|
| 48 |
return fig
|
| 49 |
|
| 50 |
+
PLOTLY_TREE = create_plotly_tree()
|
| 51 |
+
|
| 52 |
def setup_interface():
|
| 53 |
iface = gr.Interface(
|
| 54 |
+
fn=get_plotly_tree,
|
| 55 |
inputs=[],
|
| 56 |
outputs=gr.Plot(),
|
| 57 |
title="Interactive Tree Visualization"
|