Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ load_dotenv()
|
|
| 10 |
|
| 11 |
MAX_INPUT_CHARACTERS= int(os.environ.get("MAX_INPUT_CHARACTERS", default=1000))
|
| 12 |
|
| 13 |
-
ner_pipeline = pipeline("token-classification", model="projecte-aina/
|
| 14 |
|
| 15 |
def submit_input(text):
|
| 16 |
if text.strip() == "":
|
|
@@ -39,8 +39,8 @@ with gr.Blocks(**AinaGradioTheme().get_kwargs()) as demo:
|
|
| 39 |
with gr.Row():
|
| 40 |
with gr.Column():
|
| 41 |
gr.Markdown(
|
| 42 |
-
""" **
|
| 43 |
-
It has been
|
| 44 |
This result has been driven and funded by the Government of Catalonia through the [Aina](https://projecteaina.cat/).
|
| 45 |
"""
|
| 46 |
)
|
|
@@ -80,7 +80,7 @@ with gr.Blocks(**AinaGradioTheme().get_kwargs()) as demo:
|
|
| 80 |
with gr.Row():
|
| 81 |
with gr.Column(scale=0.5):
|
| 82 |
gr.Examples(
|
| 83 |
-
label="
|
| 84 |
examples=[
|
| 85 |
["""El raper nord-americà Travis Scott ha gravat el videoclip de la seva canço 'Circus Maximus' amb els Castellers de Vilafranca. Segons ha publicat la 'Revista Castells' i ha confirmat l'Agència Catalana de Notícies (ACN), el rodatge es va fer el 2 de juliol a la Tarraco Arena Plaça (TAP) de Tarragona."""],
|
| 86 |
],
|
|
@@ -89,9 +89,18 @@ with gr.Blocks(**AinaGradioTheme().get_kwargs()) as demo:
|
|
| 89 |
fn=submit_input,
|
| 90 |
)
|
| 91 |
gr.Examples(
|
| 92 |
-
label="
|
| 93 |
examples=[
|
| 94 |
-
["""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
],
|
| 96 |
inputs=[input_],
|
| 97 |
outputs=output,
|
|
|
|
| 10 |
|
| 11 |
MAX_INPUT_CHARACTERS= int(os.environ.get("MAX_INPUT_CHARACTERS", default=1000))
|
| 12 |
|
| 13 |
+
ner_pipeline = pipeline("token-classification", model="projecte-aina/deberta_multiner",aggregation_strategy="simple")
|
| 14 |
|
| 15 |
def submit_input(text):
|
| 16 |
if text.strip() == "":
|
|
|
|
| 39 |
with gr.Row():
|
| 40 |
with gr.Column():
|
| 41 |
gr.Markdown(
|
| 42 |
+
""" **deberta_multiner** is a Named Entity Recognition (NER) model for the Catalan language (but with multilingual capabilities) fine-tuned from a [DeBERTa](https://huggingface.co/microsoft/deberta-v3-base) model pre-trained on a large-size multilingual corpus collected from publicly available corpora and crawlers, with a high proportion of Spanish and Catalan texts.
|
| 43 |
+
It has been fine-tuned with a dataset (CEIL: Catalan Entity Identification and Linking ) that contains 9 main types and 52 subtypes on all kinds of short texts, with almost 59K documents.
|
| 44 |
This result has been driven and funded by the Government of Catalonia through the [Aina](https://projecteaina.cat/).
|
| 45 |
"""
|
| 46 |
)
|
|
|
|
| 80 |
with gr.Row():
|
| 81 |
with gr.Column(scale=0.5):
|
| 82 |
gr.Examples(
|
| 83 |
+
label="Catalan example:",
|
| 84 |
examples=[
|
| 85 |
["""El raper nord-americà Travis Scott ha gravat el videoclip de la seva canço 'Circus Maximus' amb els Castellers de Vilafranca. Segons ha publicat la 'Revista Castells' i ha confirmat l'Agència Catalana de Notícies (ACN), el rodatge es va fer el 2 de juliol a la Tarraco Arena Plaça (TAP) de Tarragona."""],
|
| 86 |
],
|
|
|
|
| 89 |
fn=submit_input,
|
| 90 |
)
|
| 91 |
gr.Examples(
|
| 92 |
+
label="Spanish example:",
|
| 93 |
examples=[
|
| 94 |
+
["""George Smith Patton fué un general del Ejército de los Estados Unidos en Europa durante la Segunda Guerra Mundial."""],
|
| 95 |
+
],
|
| 96 |
+
inputs=[input_],
|
| 97 |
+
outputs=output,
|
| 98 |
+
fn=submit_input,
|
| 99 |
+
)
|
| 100 |
+
gr.Examples(
|
| 101 |
+
label="English example:",
|
| 102 |
+
examples=[
|
| 103 |
+
["""The shirt Lionel Messi wore during Argentina’s 2022 Fifa World Cup final victory over France is expected to sell for a record-breaking $10m."""],
|
| 104 |
],
|
| 105 |
inputs=[input_],
|
| 106 |
outputs=output,
|