Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
def run_pipeline(input_text): | |
token_classifier = pipeline( | |
"token-classification", model="jbroermann/bert-mapa-german", aggregation_strategy="simple" | |
) | |
result = token_classifier(input_text) | |
return { | |
"text": input_text, | |
"entities": result | |
} | |
iface = gr.Interface( | |
fn=run_pipeline, | |
inputs=gr.Textbox(label="Input"), | |
outputs=gr.HighlightedText(label="Predicted Personal Information"), | |
examples=[ | |
"R. Völler, der in Hanau geboren wurde, war vom 18. Januar 2005 bis zum 1. Juli 2018 Sportdirektor von Bayer 04 Leverkusen, bevor er Aufgaben in der Bayer 04 Leverkusen Fußball GmbH an der Seite von Fernando Carro übernahm.", | |
"Der CEO der Volkswagen AG ist seit dem 01.09.2022 Oliver Blume, der unter anderem in Braunschweig studiert hat." | |
], | |
title="Identifying Personal Information in German Texts", | |
description="Using the [bert-mapa-german model](https://huggingface.co/jbroermann/bert-mapa-german) to identify personal information in German texts. The [bert-mapa-german model](https://huggingface.co/jbroermann/bert-mapa-german) is a fine-tuned version of google-bert/bert-base-german-cased on the MAPA german dataset. Try one of the examples below or write your own German text." | |
) | |
iface.launch() | |