Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,16 +80,16 @@ def plot_graph_sentence(sentence):
|
|
| 80 |
pos = nx.spring_layout(nx_graph)
|
| 81 |
plot = plt.figure(figsize=(6, 6))
|
| 82 |
nx.draw(nx_graph, pos=pos, labels={i: e for i,e in enumerate(graphs[0]["nodes"])}, with_labels = True,
|
| 83 |
-
node_size=
|
| 84 |
return plot
|
| 85 |
|
| 86 |
def get_list_sentences(id):
|
| 87 |
return gr.update(choices = dataset["train"][id]["transcript"].split("."))
|
| 88 |
|
| 89 |
with gr.Blocks() as demo:
|
| 90 |
-
id = gr.Slider(maximum=len(dataset["train"]) - 1)
|
| 91 |
-
sentence = gr.Dropdown(choices = dataset["train"][0]["transcript"].split("."), interactive = True)
|
| 92 |
-
plot = gr.Plot()
|
| 93 |
id.change(get_list_sentences, id, sentence)
|
| 94 |
sentence.change(plot_graph_sentence, sentence, plot)
|
| 95 |
|
|
|
|
| 80 |
pos = nx.spring_layout(nx_graph)
|
| 81 |
plot = plt.figure(figsize=(6, 6))
|
| 82 |
nx.draw(nx_graph, pos=pos, labels={i: e for i,e in enumerate(graphs[0]["nodes"])}, with_labels = True,
|
| 83 |
+
node_size=800, font_color='black', node_color="yellow")
|
| 84 |
return plot
|
| 85 |
|
| 86 |
def get_list_sentences(id):
|
| 87 |
return gr.update(choices = dataset["train"][id]["transcript"].split("."))
|
| 88 |
|
| 89 |
with gr.Blocks() as demo:
|
| 90 |
+
id = gr.Slider(maximum=len(dataset["train"]) - 1, label="Record #")
|
| 91 |
+
sentence = gr.Dropdown(label="Transcript sentence", choices = dataset["train"][0]["transcript"].split("."), interactive = True)
|
| 92 |
+
plot = gr.Plot(label="Dependency graph")
|
| 93 |
id.change(get_list_sentences, id, sentence)
|
| 94 |
sentence.change(plot_graph_sentence, sentence, plot)
|
| 95 |
|