Spaces:
Runtime error
Runtime error
initial
Browse files
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
with gr.Blocks() as demo:
|
| 5 |
+
gr.Markdown(
|
| 6 |
+
"""
|
| 7 |
+
# Bundesagentur für Arbeit - Demo zur automatisierten E-Mail Klassifizierung
|
| 8 |
+
Diese Demo verwendet künstliche Intelligenz, um automatisiert die Ansicht einer E-Mail zu klassifizieren und an die entsprechende Stelle weiterzuleiten.
|
| 9 |
+
"""
|
| 10 |
+
)
|
| 11 |
+
with gr.Row():
|
| 12 |
+
with gr.Column():
|
| 13 |
+
gr.Markdown("## Eingabe der E-Mail")
|
| 14 |
+
subject_textbox = gr.Textbox(placeholder="Bitte hier ihren Betreff eingeben...", label="E-Mail Betreff")
|
| 15 |
+
gr.Row()
|
| 16 |
+
body_textbox = gr.Textbox(placeholder="Bitte hier ihre E-Mail eingeben...", label="E-Mail Inhalt")
|
| 17 |
+
with gr.Column():
|
| 18 |
+
gr.Markdown("## Ergebnis der E-Mail Klassifizierung")
|
| 19 |
+
output_full_label = gr.Label(label="Gesamtklassifizierung", num_top_classes=5, show_label=False)
|
| 20 |
+
with gr.Row():
|
| 21 |
+
output_subject_label = gr.Textbox(label="Klassifizierung - Betreff")
|
| 22 |
+
output_body_label = gr.Textbox(label="Klassifizierung - E-Mail")
|
| 23 |
+
output_ner_text = gr.HighlightedText(label="Named Entity Recognition")
|
| 24 |
+
btn_submit = gr.Button(value="Ausführen")
|
| 25 |
+
btn_submit.click(perform_prediction, inputs=[subject_textbox, body_textbox], outputs=[output_full_label, output_subject_label, output_body_label, output_ner_text])
|
| 26 |
+
btn_clear = gr.Button(value="Zurücksetzen")
|
| 27 |
+
btn_clear.click(
|
| 28 |
+
lambda: [c.update(value=None) for c in [subject_textbox, body_textbox, output_full_label, output_subject_label, output_body_label, output_ner_text]],
|
| 29 |
+
inputs=[],
|
| 30 |
+
outputs=[subject_textbox, body_textbox, output_full_label, output_subject_label, output_body_label, output_ner_text]
|
| 31 |
+
)
|
| 32 |
+
gr.Examples(examples=examples, inputs=[subject_textbox, body_textbox], label="Beispiele")
|