Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
•
6f997ea
1
Parent(s):
ffb6ffc
fix
Browse files
app.py
CHANGED
@@ -120,7 +120,7 @@ def span(text, span1, span2, label1, label2, model):
|
|
120 |
Span(doc, idx2_1, idx2_2, label2),
|
121 |
]
|
122 |
else:
|
123 |
-
idx1_1 = 0
|
124 |
idx1_2 = round(len(list(doc)) / 2)
|
125 |
idx2_1 = 0
|
126 |
idx2_2 = 1
|
@@ -149,9 +149,9 @@ with demo:
|
|
149 |
|
150 |
with gr.Column():
|
151 |
gr.Markdown("# Pipeline Visualizer")
|
152 |
-
gr.Markdown(
|
|
|
153 |
gr.Image("pipeline.svg")
|
154 |
-
|
155 |
with gr.Box():
|
156 |
with gr.Column():
|
157 |
with gr.Row():
|
@@ -162,11 +162,18 @@ with demo:
|
|
162 |
model_input = gr.Dropdown(
|
163 |
choices=models, value=DEFAULT_MODEL, interactive=True, label="Pretrained Pipelines")
|
164 |
with gr.Column():
|
165 |
-
text_button = gr.Button(
|
|
|
|
|
|
|
|
|
166 |
with gr.Row():
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
170 |
button = gr.Button("Generate", variant="primary")
|
171 |
with gr.Tabs():
|
172 |
with gr.TabItem(""):
|
@@ -198,7 +205,7 @@ with demo:
|
|
198 |
gr.Markdown(
|
199 |
"## [Entity Recognizer](https://spacy.io/usage/visualizers#ent)")
|
200 |
gr.Markdown(
|
201 |
-
|
202 |
entity_input = gr.CheckboxGroup(
|
203 |
DEFAULT_ENTS, value=DEFAULT_ENTS)
|
204 |
entity_output = gr.HTML(value=entity(
|
@@ -208,7 +215,8 @@ with demo:
|
|
208 |
with gr.Column():
|
209 |
gr.Markdown(
|
210 |
"## [Token Properties](https://spacy.io/usage/linguistic-features)")
|
211 |
-
gr.Markdown(
|
|
|
212 |
with gr.Column():
|
213 |
with gr.Row():
|
214 |
with gr.Column():
|
@@ -223,7 +231,8 @@ with demo:
|
|
223 |
with gr.Column():
|
224 |
gr.Markdown(
|
225 |
"## [Word and Phrase Similarity](https://spacy.io/usage/linguistic-features#vectors-similarity)")
|
226 |
-
gr.Markdown(
|
|
|
227 |
with gr.Row():
|
228 |
with gr.Column():
|
229 |
sim_text1 = gr.Textbox(
|
@@ -242,7 +251,8 @@ with demo:
|
|
242 |
with gr.Column():
|
243 |
gr.Markdown(
|
244 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
245 |
-
gr.Markdown(
|
|
|
246 |
with gr.Column():
|
247 |
with gr.Row():
|
248 |
with gr.Column():
|
|
|
120 |
Span(doc, idx2_1, idx2_2, label2),
|
121 |
]
|
122 |
else:
|
123 |
+
idx1_1 = 0
|
124 |
idx1_2 = round(len(list(doc)) / 2)
|
125 |
idx2_1 = 0
|
126 |
idx2_2 = 1
|
|
|
149 |
|
150 |
with gr.Column():
|
151 |
gr.Markdown("# Pipeline Visualizer")
|
152 |
+
gr.Markdown(
|
153 |
+
"### Visualize parts of the spaCy pipeline in an interactive demo.")
|
154 |
gr.Image("pipeline.svg")
|
|
|
155 |
with gr.Box():
|
156 |
with gr.Column():
|
157 |
with gr.Row():
|
|
|
162 |
model_input = gr.Dropdown(
|
163 |
choices=models, value=DEFAULT_MODEL, interactive=True, label="Pretrained Pipelines")
|
164 |
with gr.Column():
|
165 |
+
text_button = gr.Button(
|
166 |
+
"Get text in model language")
|
167 |
+
with gr.Column():
|
168 |
+
gr.Markdown("")
|
169 |
+
|
170 |
with gr.Row():
|
171 |
+
with gr.Column():
|
172 |
+
text_input = gr.Textbox(
|
173 |
+
value=DEFAULT_TEXT, interactive=True, label="Input Text")
|
174 |
+
with gr.Column():
|
175 |
+
gr.Markdown("")
|
176 |
+
|
177 |
button = gr.Button("Generate", variant="primary")
|
178 |
with gr.Tabs():
|
179 |
with gr.TabItem(""):
|
|
|
205 |
gr.Markdown(
|
206 |
"## [Entity Recognizer](https://spacy.io/usage/visualizers#ent)")
|
207 |
gr.Markdown(
|
208 |
+
"The entity visualizer, `ent`, highlights named entities and their labels in a text.")
|
209 |
entity_input = gr.CheckboxGroup(
|
210 |
DEFAULT_ENTS, value=DEFAULT_ENTS)
|
211 |
entity_output = gr.HTML(value=entity(
|
|
|
215 |
with gr.Column():
|
216 |
gr.Markdown(
|
217 |
"## [Token Properties](https://spacy.io/usage/linguistic-features)")
|
218 |
+
gr.Markdown(
|
219 |
+
"When you put in raw text to spaCy, it returns a `Doc` object with different linguistic features")
|
220 |
with gr.Column():
|
221 |
with gr.Row():
|
222 |
with gr.Column():
|
|
|
231 |
with gr.Column():
|
232 |
gr.Markdown(
|
233 |
"## [Word and Phrase Similarity](https://spacy.io/usage/linguistic-features#vectors-similarity)")
|
234 |
+
gr.Markdown(
|
235 |
+
"Words and spans have similarity ratings based off of their word vectors, or word embeddings")
|
236 |
with gr.Row():
|
237 |
with gr.Column():
|
238 |
sim_text1 = gr.Textbox(
|
|
|
251 |
with gr.Column():
|
252 |
gr.Markdown(
|
253 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
254 |
+
gr.Markdown(
|
255 |
+
"The span visualizer, `span`, highlights overlapping spans in a text.")
|
256 |
with gr.Column():
|
257 |
with gr.Row():
|
258 |
with gr.Column():
|