Update app.py
Browse files
app.py
CHANGED
@@ -62,17 +62,12 @@ def add_to_graph(
|
|
62 |
fig: go.Figure = create_plotly_graph(lesson_graph)
|
63 |
|
64 |
# Convert Plotly figure to HTML
|
65 |
-
|
66 |
-
fig,
|
67 |
-
full_html=False,
|
68 |
-
include_plotlyjs=True,
|
69 |
-
config={'displayModeBar': False}
|
70 |
-
)
|
71 |
|
72 |
# Wrap the plot HTML in a div with a fixed size
|
73 |
plot_html = f'<div style="width:100%;height:500px">{plot_html}</div>'
|
74 |
|
75 |
-
return search_string,
|
76 |
|
77 |
def create_plotly_graph(graph: nx.DiGraph) -> go.Figure:
|
78 |
pos: Dict[Any, Tuple[float, float]] = nx.spring_layout(graph)
|
@@ -187,7 +182,7 @@ with demo:
|
|
187 |
clear_btn = gr.Button("Clear Landscape")
|
188 |
|
189 |
search_output = gr.Textbox(label="Content Discovery Search String")
|
190 |
-
graph_output = gr.
|
191 |
message_output = gr.Textbox(label="Landscape Status")
|
192 |
|
193 |
generate_btn.click(
|
|
|
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)
|
|
|
182 |
clear_btn = gr.Button("Clear Landscape")
|
183 |
|
184 |
search_output = gr.Textbox(label="Content Discovery Search String")
|
185 |
+
graph_output = gr.Plot(label="Your Educational Landscape")
|
186 |
message_output = gr.Textbox(label="Landscape Status")
|
187 |
|
188 |
generate_btn.click(
|