email-parser / app.py
Nikhil Singh
error check
fc419b1
raw
history blame
634 Bytes
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()