Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
•
551011b
1
Parent(s):
fd44dc1
small refactor
Browse files
app.py
CHANGED
@@ -154,28 +154,26 @@ with demo:
|
|
154 |
gr.Image("pipeline.svg")
|
155 |
with gr.Box():
|
156 |
with gr.Column():
|
|
|
157 |
with gr.Row():
|
158 |
with gr.Column():
|
159 |
-
gr.
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
gr.Markdown("")
|
177 |
-
|
178 |
-
button = gr.Button("Generate", variant="primary")
|
179 |
with gr.Tabs():
|
180 |
with gr.TabItem(""):
|
181 |
with gr.Column():
|
@@ -196,10 +194,9 @@ with demo:
|
|
196 |
with gr.Column():
|
197 |
text = gr.Textbox(
|
198 |
label="Text Color", value="black")
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
DEFAULT_TEXT, True, True, False, DEFAULT_COLOR, "black", DEFAULT_MODEL))
|
203 |
dep_button = gr.Button("Generate Dependency Parser")
|
204 |
gr.Markdown(" ")
|
205 |
with gr.Box():
|
@@ -219,15 +216,14 @@ with demo:
|
|
219 |
"## [Token Properties](https://spacy.io/usage/linguistic-features)")
|
220 |
gr.Markdown(
|
221 |
"When you put in raw text to spaCy, it returns a Doc object with different linguistic features")
|
222 |
-
with gr.
|
223 |
-
with gr.
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
DEFAULT_TEXT, DEFAULT_TOK_ATTR, DEFAULT_MODEL), overflow_row_behaviour="paginate")
|
231 |
tok_button = gr.Button("Generate Token Properties")
|
232 |
with gr.Box():
|
233 |
with gr.Column():
|
@@ -255,34 +251,34 @@ with demo:
|
|
255 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
256 |
gr.Markdown(
|
257 |
"The span visualizer highlights overlapping spans in a text.")
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
|
287 |
model_input.change(get_text, inputs=[model_input], outputs=text_input)
|
288 |
button.click(dependency, inputs=[
|
|
|
154 |
gr.Image("pipeline.svg")
|
155 |
with gr.Box():
|
156 |
with gr.Column():
|
157 |
+
gr.Markdown(" ## Choose a language model and text")
|
158 |
with gr.Row():
|
159 |
with gr.Column():
|
160 |
+
model_input = gr.Dropdown(
|
161 |
+
choices=models, value=DEFAULT_MODEL, interactive=True, label="Pretrained Pipelines")
|
162 |
+
with gr.Column():
|
163 |
+
gr.Markdown("")
|
164 |
+
with gr.Column():
|
165 |
+
gr.Markdown("")
|
166 |
+
with gr.Column():
|
167 |
+
gr.Markdown("")
|
168 |
+
|
169 |
+
with gr.Row():
|
170 |
+
with gr.Column():
|
171 |
+
text_input = gr.Textbox(
|
172 |
+
value=DEFAULT_TEXT, interactive=True, label="Input Text")
|
173 |
+
with gr.Column():
|
174 |
+
gr.Markdown("")
|
175 |
+
|
176 |
+
button = gr.Button("Generate", variant="primary")
|
|
|
|
|
|
|
177 |
with gr.Tabs():
|
178 |
with gr.TabItem(""):
|
179 |
with gr.Column():
|
|
|
194 |
with gr.Column():
|
195 |
text = gr.Textbox(
|
196 |
label="Text Color", value="black")
|
197 |
+
|
198 |
+
depen_output = gr.HTML(value=dependency(
|
199 |
+
DEFAULT_TEXT, True, True, False, DEFAULT_COLOR, "black", DEFAULT_MODEL))
|
|
|
200 |
dep_button = gr.Button("Generate Dependency Parser")
|
201 |
gr.Markdown(" ")
|
202 |
with gr.Box():
|
|
|
216 |
"## [Token Properties](https://spacy.io/usage/linguistic-features)")
|
217 |
gr.Markdown(
|
218 |
"When you put in raw text to spaCy, it returns a Doc object with different linguistic features")
|
219 |
+
with gr.Row():
|
220 |
+
with gr.Column():
|
221 |
+
tok_input = gr.CheckboxGroup(
|
222 |
+
DEFAULT_TOK_ATTR, value=DEFAULT_TOK_ATTR)
|
223 |
+
with gr.Column():
|
224 |
+
gr.Markdown("")
|
225 |
+
tok_output = gr.Dataframe(headers=DEFAULT_TOK_ATTR, value=default_token(
|
226 |
+
DEFAULT_TEXT, DEFAULT_TOK_ATTR, DEFAULT_MODEL), overflow_row_behaviour="paginate")
|
|
|
227 |
tok_button = gr.Button("Generate Token Properties")
|
228 |
with gr.Box():
|
229 |
with gr.Column():
|
|
|
251 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
252 |
gr.Markdown(
|
253 |
"The span visualizer highlights overlapping spans in a text.")
|
254 |
+
|
255 |
+
with gr.Row():
|
256 |
+
with gr.Column():
|
257 |
+
span1 = gr.Textbox(
|
258 |
+
label="Span 1", value="U.K. startup", placeholder="Input a part of the sentence")
|
259 |
+
with gr.Column():
|
260 |
+
label1 = gr.Textbox(value="ORG",
|
261 |
+
label="Label for Span 1")
|
262 |
+
with gr.Column():
|
263 |
+
gr.Markdown("")
|
264 |
+
with gr.Column():
|
265 |
+
gr.Markdown("")
|
266 |
+
with gr.Row():
|
267 |
+
with gr.Column():
|
268 |
+
span2 = gr.Textbox(
|
269 |
+
label="Span 2", value="U.K.", placeholder="Input another part of the sentence")
|
270 |
+
with gr.Column():
|
271 |
+
label2 = gr.Textbox(value="GPE",
|
272 |
+
label="Label for Span 2")
|
273 |
+
with gr.Column():
|
274 |
+
gr.Markdown("")
|
275 |
+
with gr.Column():
|
276 |
+
gr.Markdown("")
|
277 |
+
span_output = gr.HTML(value=span(
|
278 |
+
DEFAULT_TEXT, "U.K. startup", "U.K.", "ORG", "GPE", DEFAULT_MODEL))
|
279 |
+
gr.Markdown(value="")
|
280 |
+
gr.Markdown(value="")
|
281 |
+
span_button = gr.Button("Generate spans")
|
282 |
|
283 |
model_input.change(get_text, inputs=[model_input], outputs=text_input)
|
284 |
button.click(dependency, inputs=[
|