fix add_to_graph
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def add_to_graph(
|
|
29 |
assessment: str,
|
30 |
resource: str,
|
31 |
school_board: str
|
32 |
-
) -> Tuple[str,
|
33 |
global lesson_graph
|
34 |
|
35 |
# Clear previous graph
|
@@ -61,14 +61,9 @@ def add_to_graph(
|
|
61 |
# Create Plotly graph
|
62 |
fig: go.Figure = create_plotly_graph(lesson_graph)
|
63 |
|
64 |
-
# Convert Plotly figure to HTML
|
65 |
-
fig # Directly use the Plotly figure object for Gradio's Plot component
|
66 |
-
|
67 |
-
# Wrap the plot HTML in a div with a fixed size
|
68 |
-
plot_html = f'<div style="width:100%;height:500px">{plot_html}</div>'
|
69 |
-
|
70 |
return search_string, fig
|
71 |
|
|
|
72 |
def create_plotly_graph(graph: nx.DiGraph) -> go.Figure:
|
73 |
pos: Dict[Any, Tuple[float, float]] = nx.spring_layout(graph)
|
74 |
|
|
|
29 |
assessment: str,
|
30 |
resource: str,
|
31 |
school_board: str
|
32 |
+
) -> Tuple[str, go.Figure]:
|
33 |
global lesson_graph
|
34 |
|
35 |
# Clear previous graph
|
|
|
61 |
# Create Plotly graph
|
62 |
fig: go.Figure = create_plotly_graph(lesson_graph)
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
return search_string, fig
|
65 |
|
66 |
+
|
67 |
def create_plotly_graph(graph: nx.DiGraph) -> go.Figure:
|
68 |
pos: Dict[Any, Tuple[float, float]] = nx.spring_layout(graph)
|
69 |
|