Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
•
1603e0b
1
Parent(s):
142bca6
fix: make prettier
Browse files
app.py
CHANGED
@@ -143,58 +143,80 @@ demo = gr.Blocks()
|
|
143 |
|
144 |
with demo:
|
145 |
with gr.Box():
|
146 |
-
with gr.Row():
|
147 |
-
with gr.Row():
|
148 |
-
gr.Markdown("Chose a language model")
|
149 |
-
model_input = gr.Dropdown(
|
150 |
-
choices=models, value=DEFAULT_MODEL, interactive=True, label="Pretrained Pipelines")
|
151 |
-
text_button = gr.Button("Get text in new language")
|
152 |
-
with gr.Row():
|
153 |
-
text_input = gr.Textbox(
|
154 |
-
value=DEFAULT_TEXT, interactive=True, label="Input Text")
|
155 |
-
button = gr.Button("Generate", variant="primary")
|
156 |
-
with gr.Column():
|
157 |
-
gr.Markdown("Dependency Parser")
|
158 |
-
col_punct = gr.Checkbox(label="Collapse Punctuation", value=True)
|
159 |
-
col_phrase = gr.Checkbox(label="Collapse Phrases", value=True)
|
160 |
-
compact = gr.Checkbox(label="Compact", value=False)
|
161 |
-
depen_output = gr.HTML(value=dependency(DEFAULT_TEXT, True, True, False, DEFAULT_MODEL))
|
162 |
-
dep_button = gr.Button("Generate Dependency Parser")
|
163 |
-
gr.Markdown("Entity Recognizer")
|
164 |
-
entity_input = gr.CheckboxGroup(DEFAULT_ENTS, value=DEFAULT_ENTS)
|
165 |
-
entity_output = gr.HTML(value=entity(DEFAULT_TEXT, DEFAULT_ENTS, DEFAULT_MODEL))
|
166 |
-
ent_button = gr.Button("Generate Entity Recognizer")
|
167 |
-
gr.Markdown("Token Properties")
|
168 |
-
with gr.Column():
|
169 |
-
tok_input = gr.CheckboxGroup(
|
170 |
-
DEFAULT_TOK_ATTR, value=DEFAULT_TOK_ATTR)
|
171 |
-
tok_output = gr.Dataframe(value=default_token(DEFAULT_TEXT, DEFAULT_TOK_ATTR, DEFAULT_MODEL),overflow_row_behaviour="paginate")
|
172 |
-
tok_button = gr.Button("Generate Token Properties")
|
173 |
-
gr.Markdown("Word and Phrase Similarity")
|
174 |
-
with gr.Row():
|
175 |
-
sim_text1 = gr.Textbox(
|
176 |
-
value="Apple", label="Chosen", interactive=True,)
|
177 |
-
sim_text2 = gr.Textbox(
|
178 |
-
value="U.K. startup", label="Chosen", interactive=True,)
|
179 |
-
sim_output = gr.Textbox(label="Similarity Score", value="0.12")
|
180 |
-
sim_random_button = gr.Button("Generate random words")
|
181 |
-
sim_button = gr.Button("Generate similarity")
|
182 |
-
gr.Markdown("Spans")
|
183 |
with gr.Column():
|
|
|
184 |
with gr.Row():
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
with gr.Row():
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
gr.
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
text_button.click(get_text, inputs=[model_input], outputs=text_input)
|
199 |
button.click(dependency, inputs=[
|
200 |
text_input, col_punct, col_phrase, compact, model_input], outputs=depen_output)
|
|
|
143 |
|
144 |
with demo:
|
145 |
with gr.Box():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
with gr.Column():
|
147 |
+
gr.Markdown(" ## Chose a language model and input text")
|
148 |
with gr.Row():
|
149 |
+
with gr.Column():
|
150 |
+
model_input = gr.Dropdown(
|
151 |
+
choices=models, value=DEFAULT_MODEL, interactive=True, label="Pretrained Pipelines")
|
152 |
+
with gr.Column():
|
153 |
+
gr.Markdown("")
|
154 |
+
with gr.Column():
|
155 |
+
gr.Markdown("")
|
156 |
+
with gr.Column():
|
157 |
+
gr.Markdown("")
|
158 |
+
|
159 |
+
text_button = gr.Button("Get text in model language")
|
160 |
with gr.Row():
|
161 |
+
with gr.Column():
|
162 |
+
text_input = gr.Textbox(
|
163 |
+
value=DEFAULT_TEXT, interactive=True, label="Input Text")
|
164 |
+
with gr.Column():
|
165 |
+
gr.Markdown("")
|
166 |
+
button = gr.Button("Generate", variant="primary")
|
167 |
+
with gr.Column():
|
168 |
+
with gr.Box():
|
169 |
+
with gr.Column():
|
170 |
+
gr.Markdown("### Dependency Parser")
|
171 |
+
col_punct = gr.Checkbox(label="Collapse Punctuation", value=True)
|
172 |
+
col_phrase = gr.Checkbox(label="Collapse Phrases", value=True)
|
173 |
+
compact = gr.Checkbox(label="Compact", value=False)
|
174 |
+
depen_output = gr.HTML(value=dependency(DEFAULT_TEXT, True, True, False, DEFAULT_MODEL))
|
175 |
+
dep_button = gr.Button("Generate Dependency Parser")
|
176 |
+
with gr.Box():
|
177 |
+
with gr.Column():
|
178 |
+
gr.Markdown("Entity Recognizer")
|
179 |
+
entity_input = gr.CheckboxGroup(DEFAULT_ENTS, value=DEFAULT_ENTS)
|
180 |
+
entity_output = gr.HTML(value=entity(DEFAULT_TEXT, DEFAULT_ENTS, DEFAULT_MODEL))
|
181 |
+
ent_button = gr.Button("Generate Entity Recognizer")
|
182 |
+
with gr.Box():
|
183 |
+
with gr.Column():
|
184 |
+
gr.Markdown("### Token Properties")
|
185 |
+
with gr.Column():
|
186 |
+
tok_input = gr.CheckboxGroup(
|
187 |
+
DEFAULT_TOK_ATTR, value=DEFAULT_TOK_ATTR)
|
188 |
+
tok_output = gr.Dataframe(headers=DEFAULT_TOK_ATTR, value=default_token(DEFAULT_TEXT, DEFAULT_TOK_ATTR, DEFAULT_MODEL), overflow_row_behaviour="paginate")
|
189 |
+
tok_button = gr.Button("Generate Token Properties")
|
190 |
+
with gr.Box():
|
191 |
+
with gr.Column():
|
192 |
+
gr.Markdown("### Word and Phrase Similarity")
|
193 |
+
with gr.Row():
|
194 |
+
sim_text1 = gr.Textbox(
|
195 |
+
value="Apple", label="Word 1", interactive=True,)
|
196 |
+
sim_text2 = gr.Textbox(
|
197 |
+
value="U.K. startup", label="Word 2", interactive=True,)
|
198 |
+
sim_output = gr.Textbox(label="Similarity Score", value="0.12")
|
199 |
+
sim_random_button = gr.Button("Generate random words")
|
200 |
+
sim_button = gr.Button("Generate similarity")
|
201 |
+
with gr.Box():
|
202 |
+
with gr.Column():
|
203 |
+
gr.Markdown("### Spans")
|
204 |
+
with gr.Column():
|
205 |
+
with gr.Row():
|
206 |
+
span1 = gr.Textbox(
|
207 |
+
label="Span 1", value="U.K. startup", placeholder="Input a part of the sentence")
|
208 |
+
label1 = gr.Textbox(value="ORG",
|
209 |
+
label="Label for Span 1")
|
210 |
+
with gr.Row():
|
211 |
+
span2 = gr.Textbox(
|
212 |
+
label="Span 2", value="U.K.", placeholder="Input another part of the sentence")
|
213 |
+
label2 = gr.Textbox(value="GPE",
|
214 |
+
label="Label for Span 2")
|
215 |
+
span_output = gr.HTML(value=span(DEFAULT_TEXT, "U.K. startup", "U.K.", "ORG", "GPE", DEFAULT_MODEL))
|
216 |
+
gr.Markdown(value="\n\n\n\n")
|
217 |
+
gr.Markdown(value="\n\n\n\n")
|
218 |
+
span_button = gr.Button("Generate spans")
|
219 |
+
|
220 |
text_button.click(get_text, inputs=[model_input], outputs=text_input)
|
221 |
button.click(dependency, inputs=[
|
222 |
text_input, col_punct, col_phrase, compact, model_input], outputs=depen_output)
|