Spaces:
Running
Running
File size: 723 Bytes
8fa8c73 21bed23 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from transformers import pipeline
import gradio as gr
ner_pipeline = pipeline(model="projecte-aina/roberta-base-ca-v2-cased-ner")
exemples = ["El Joan no ha anat mai a Manresa"]
def ner(text):
output = ner_pipeline(text)
return {"text": text, "entities": output}
demo = gr.Interface(
ner,
gr.Textbox(label="Text", placeholder="Escriu aquí..."),
gr.HighlightedText(label="sortida"),
allow_flagging="never",
title="Reconeixament d'entitats nomenades en català",
description="Escriu o copia un text i troba les seves entitats",
theme=gr.themes.Glass(),
submit_btn=gr.Button("Troba entitats", variant="primary"),
clear_btn=gr.Button("Neteja"),
examples=exemples
)
demo.launch(show_api=False) |