Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import networkx as nx
|
|
5 |
|
6 |
|
7 |
def render_dependency_tree(words, parents, labels):
|
8 |
-
fig, ax = plt.subplots(figsize=(32,
|
9 |
|
10 |
# Create a directed graph
|
11 |
G = nx.DiGraph()
|
@@ -143,19 +143,22 @@ with gr.Blocks(theme='sudeepshouche/minimalist', css=custom_css) as demo:
|
|
143 |
with gr.Row():
|
144 |
with gr.Column(scale=1):
|
145 |
source = gr.Textbox(
|
146 |
-
label="Input sentence", placeholder="Write a sentende to parse", show_label=
|
147 |
)
|
148 |
submit = gr.Button("Submit", variant="primary")
|
|
|
149 |
with gr.Column(scale=1):
|
150 |
dataset = gr.Dataset(components=[gr.Textbox(visible=False)],
|
151 |
label="Input examples",
|
152 |
samples=[
|
153 |
["Thomassen er på vei til sin neste gjerning."],
|
154 |
-
["
|
|
|
|
|
155 |
]
|
156 |
)
|
157 |
|
158 |
-
gr.DataFrame(**render_table(forms, lemmas, upos, xpos, feats, metadata, edges, edge_labels), interactive=False, datatype="markdown")
|
159 |
-
gr.Plot(render_dependency_tree(forms, edges, edge_labels), container=False)
|
160 |
|
161 |
demo.launch()
|
|
|
5 |
|
6 |
|
7 |
def render_dependency_tree(words, parents, labels):
|
8 |
+
fig, ax = plt.subplots(figsize=(32, 16))
|
9 |
|
10 |
# Create a directed graph
|
11 |
G = nx.DiGraph()
|
|
|
143 |
with gr.Row():
|
144 |
with gr.Column(scale=1):
|
145 |
source = gr.Textbox(
|
146 |
+
label="Input sentence", placeholder="Write a sentende to parse", show_label=False, lines=1, max_lines=5, autofocus=True
|
147 |
)
|
148 |
submit = gr.Button("Submit", variant="primary")
|
149 |
+
|
150 |
with gr.Column(scale=1):
|
151 |
dataset = gr.Dataset(components=[gr.Textbox(visible=False)],
|
152 |
label="Input examples",
|
153 |
samples=[
|
154 |
["Thomassen er på vei til sin neste gjerning."],
|
155 |
+
["På toppen av dette kom de metodiske utfordringer."],
|
156 |
+
["Berntsen har påtatt seg en både viktig og vanskelig oppgave."],
|
157 |
+
["Ikke bare har det vært et problem, som han selv skriver i forordet, å bli klok på Borten."],
|
158 |
]
|
159 |
)
|
160 |
|
161 |
+
table = gr.DataFrame(**render_table(forms, lemmas, upos, xpos, feats, metadata, edges, edge_labels), interactive=False, datatype="markdown")
|
162 |
+
dependency_plot = gr.Plot(render_dependency_tree(forms, edges, edge_labels), container=False)
|
163 |
|
164 |
demo.launch()
|