Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
•
cb57978
1
Parent(s):
6ec67db
fix: tokens dataframe header
Browse files- app.py +4 -1
- requirements.txt +1 -1
app.py
CHANGED
@@ -3,6 +3,7 @@ from spacy import displacy
|
|
3 |
import random
|
4 |
from spacy.tokens import Span
|
5 |
import gradio as gr
|
|
|
6 |
|
7 |
DEFAULT_MODEL = "en_core_web"
|
8 |
DEFAULT_TEXT = "Apple is looking at buying U.K. startup for $1 billion."
|
@@ -57,6 +58,7 @@ def token(text, attributes, model):
|
|
57 |
for attr in attributes:
|
58 |
tok_data.append(getattr(tok, attr))
|
59 |
data.append(tok_data)
|
|
|
60 |
return data
|
61 |
|
62 |
|
@@ -150,7 +152,8 @@ with demo:
|
|
150 |
with gr.Column():
|
151 |
tok_input = gr.CheckboxGroup(
|
152 |
DEFAULT_TOK_ATTR, value=DEFAULT_TOK_ATTR)
|
153 |
-
tok_output = gr.Dataframe(
|
|
|
154 |
tok_button = gr.Button("Generate this tab")
|
155 |
with gr.TabItem("Similarity"):
|
156 |
with gr.Row():
|
|
|
3 |
import random
|
4 |
from spacy.tokens import Span
|
5 |
import gradio as gr
|
6 |
+
import pandas as pd
|
7 |
|
8 |
DEFAULT_MODEL = "en_core_web"
|
9 |
DEFAULT_TEXT = "Apple is looking at buying U.K. startup for $1 billion."
|
|
|
58 |
for attr in attributes:
|
59 |
tok_data.append(getattr(tok, attr))
|
60 |
data.append(tok_data)
|
61 |
+
data = pd.DataFrame(data, columns=attributes)
|
62 |
return data
|
63 |
|
64 |
|
|
|
152 |
with gr.Column():
|
153 |
tok_input = gr.CheckboxGroup(
|
154 |
DEFAULT_TOK_ATTR, value=DEFAULT_TOK_ATTR)
|
155 |
+
tok_output = gr.Dataframe(
|
156 |
+
headers=DEFAULT_TOK_ATTR, overflow_row_behaviour="paginate")
|
157 |
tok_button = gr.Button("Generate this tab")
|
158 |
with gr.TabItem("Similarity"):
|
159 |
with gr.Row():
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
gradio==3.0.18
|
3 |
spacy==3.3.1
|
4 |
|
|
|
1 |
+
pandas==1.4.2
|
2 |
gradio==3.0.18
|
3 |
spacy==3.3.1
|
4 |
|