Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,13 +70,12 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
| 70 |
ex3 = "From: accounts@supplier.com\nSubject: Invoice #2024-00123 Due Date Reminder\nDear Valued Client, This is a reminder invoice #2024-00123 for $1,500.00 is due..."
|
| 71 |
ex4 = "From: it@company.com\nSubject: Server Down Alert\nURGENT: Database server unreachable since 3AM. Needs escalation."
|
| 72 |
ex5 = "From: spammer@promo.com\nSubject: BIG SALE!!!\nDon't miss our special offers!"
|
| 73 |
-
gr.Button("Support Request")
|
| 74 |
-
gr.Button("Sales Inquiry")
|
| 75 |
-
gr.Button("Finance / Billing")
|
| 76 |
-
gr.Button("Urgent Incident")
|
| 77 |
-
gr.Button("Spam / Marketing")
|
| 78 |
-
|
| 79 |
-
gr.Markdown("#### 📋 Paste or Load a Full Email:")
|
| 80 |
email_box = gr.Textbox(lines=8, label="Paste the entire raw email (including lines like 'From:', 'Subject:', etc.)", elem_id='email_box')
|
| 81 |
classify_btn = gr.Button("Classify Email", elem_id='classify_btn', variant="primary")
|
| 82 |
|
|
@@ -98,6 +97,12 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
| 98 |
gr.Markdown("#### 🟣 Extracted Action Items")
|
| 99 |
action_items = gr.Textbox(lines=4, label="Extracted Action Items", elem_id='actions')
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
def classify_and_render(email_text):
|
| 102 |
result = email_classifier_router(email_text)
|
| 103 |
cat = result.get("Category", "")
|
|
|
|
| 70 |
ex3 = "From: accounts@supplier.com\nSubject: Invoice #2024-00123 Due Date Reminder\nDear Valued Client, This is a reminder invoice #2024-00123 for $1,500.00 is due..."
|
| 71 |
ex4 = "From: it@company.com\nSubject: Server Down Alert\nURGENT: Database server unreachable since 3AM. Needs escalation."
|
| 72 |
ex5 = "From: spammer@promo.com\nSubject: BIG SALE!!!\nDon't miss our special offers!"
|
| 73 |
+
support_button = gr.Button("Support Request")
|
| 74 |
+
sales_button = gr.Button("Sales Inquiry")
|
| 75 |
+
finance_button = gr.Button("Finance / Billing")
|
| 76 |
+
urgent_button = gr.Button("Urgent Incident")
|
| 77 |
+
spam_button = gr.Button("Spam / Marketing")
|
| 78 |
+
|
|
|
|
| 79 |
email_box = gr.Textbox(lines=8, label="Paste the entire raw email (including lines like 'From:', 'Subject:', etc.)", elem_id='email_box')
|
| 80 |
classify_btn = gr.Button("Classify Email", elem_id='classify_btn', variant="primary")
|
| 81 |
|
|
|
|
| 97 |
gr.Markdown("#### 🟣 Extracted Action Items")
|
| 98 |
action_items = gr.Textbox(lines=4, label="Extracted Action Items", elem_id='actions')
|
| 99 |
|
| 100 |
+
support_button.click(lambda: ex1, None, email_box)
|
| 101 |
+
sales_button.click(lambda: ex2, None, email_box)
|
| 102 |
+
finance_button.click(lambda: ex3, None, email_box)
|
| 103 |
+
urgent_button.click(lambda: ex4, None, email_box)
|
| 104 |
+
spam_button.click(lambda: ex5, None, email_box)
|
| 105 |
+
|
| 106 |
def classify_and_render(email_text):
|
| 107 |
result = email_classifier_router(email_text)
|
| 108 |
cat = result.get("Category", "")
|