Spaces:
Running
Running
File size: 1,012 Bytes
6db87f4 a252c82 6db87f4 704f144 6db87f4 704f144 a252c82 96f220f a252c82 96f220f 6db87f4 96f220f 6db87f4 a252c82 704f144 6db87f4 a252c82 6db87f4 a252c82 |
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 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from analyze_email_main import analyze_email
def analyze_uploaded_email(file_path):
try:
results = analyze_email(file_path)
if isinstance(results, dict):
output = []
for section, findings in results.items():
output.append(f"--- {section.upper()} ---")
if findings:
output.extend(findings)
else:
output.append("No issues found")
return "\n".join(output)
elif isinstance(results, list):
return "\n".join(results)
else:
return str(results)
except Exception as e:
return f"❌ Error analyzing email: {e}"
iface = gr.Interface(
fn=analyze_uploaded_email,
inputs=gr.File(type="filepath", label="Upload .eml file"),
outputs="text",
title="Email Analysis Tool",
description="Upload a .eml file to analyze headers, body, and URLs."
)
if __name__ == "__main__":
iface.launch()
|