Spaces:
Sleeping
Sleeping
| 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() | |