File size: 634 Bytes
2fe2a42
 
8efe659
 
fc419b1
2fe2a42
 
 
 
 
 
 
 
 
 
 
 
 
 
8efe659
2fe2a42
 
8efe659
 
 
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
import os

import gradio as gr

# from gliner import GLiNER
from typing import Dict, Union, List
from mailparser import parse_from_string

def receive_mail(name):
    email = parse_from_string(name)
    # print("Subject:", )
    # print("From:", email.from_)
    # print("To:", email.to)
    # print("Date:", email.date)
    # print("Message ID:", email.message_id)
    # print("Headers:", email.headers)
    # print("Attachments:", email.attachments)
    return email.subject

def greet(name):
    email_subject = receive_mail(name)
    return email_subject

demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()