Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from mailparser import parse_from_string | |
| def receive_mail(name): | |
| email = parse_from_string(name) | |
| return { | |
| "Subject": email.subject, | |
| "From": email.from_, | |
| "To": email.to, | |
| "Date": email.date, | |
| "Message ID": email.message_id, | |
| "Headers": email.headers, | |
| "Attachments": email.attachments | |
| } | |
| def greet(name): | |
| email_info = receive_mail(name) | |
| return ([email_info["Subject"], | |
| email_info["From"], | |
| email_info["To"], | |
| email_info["Date"], | |
| email_info["Message ID"], | |
| email_info["Headers"], | |
| email_info["Attachments"]]) | |
| demo = gr.Interface(fn=greet, | |
| inputs="text", | |
| outputs=["text", | |
| "text", | |
| "text", | |
| "text", | |
| "text", | |
| "text", | |
| "text"], | |
| title="Email Info", | |
| description="Enter the email content below to view its details.") | |
| demo.launch() | |