Spaces:
Runtime error
Runtime error
import gradio as gr | |
with gr.Blocks() as demo: | |
gr.Markdown( | |
""" | |
# Bundesagentur für Arbeit - Demo zur automatisierten E-Mail Klassifizierung | |
Diese Demo verwendet künstliche Intelligenz, um automatisiert die Ansicht einer E-Mail zu klassifizieren und an die entsprechende Stelle weiterzuleiten. | |
""" | |
) | |
with gr.Row(): | |
with gr.Column(): | |
gr.Markdown("## Eingabe der E-Mail") | |
subject_textbox = gr.Textbox(placeholder="Bitte hier ihren Betreff eingeben...", label="E-Mail Betreff") | |
gr.Row() | |
body_textbox = gr.Textbox(placeholder="Bitte hier ihre E-Mail eingeben...", label="E-Mail Inhalt") | |
with gr.Column(): | |
gr.Markdown("## Ergebnis der E-Mail Klassifizierung") | |
output_full_label = gr.Label(label="Gesamtklassifizierung", num_top_classes=5, show_label=False) | |
with gr.Row(): | |
output_subject_label = gr.Textbox(label="Klassifizierung - Betreff") | |
output_body_label = gr.Textbox(label="Klassifizierung - E-Mail") | |
output_ner_text = gr.HighlightedText(label="Named Entity Recognition") | |
btn_submit = gr.Button(value="Ausführen") | |
btn_submit.click(perform_prediction, inputs=[subject_textbox, body_textbox], outputs=[output_full_label, output_subject_label, output_body_label, output_ner_text]) | |
btn_clear = gr.Button(value="Zurücksetzen") | |
btn_clear.click( | |
lambda: [c.update(value=None) for c in [subject_textbox, body_textbox, output_full_label, output_subject_label, output_body_label, output_ner_text]], | |
inputs=[], | |
outputs=[subject_textbox, body_textbox, output_full_label, output_subject_label, output_body_label, output_ner_text] | |
) | |
gr.Examples(examples=examples, inputs=[subject_textbox, body_textbox], label="Beispiele") |