Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# For now, let's make a simple test function.
|
| 4 |
+
# Later we'll connect it to analyze_email_main.py
|
| 5 |
+
def analyze_eml_file(file):
|
| 6 |
+
try:
|
| 7 |
+
with open(file.name, "rb") as f:
|
| 8 |
+
raw_email = f.read()
|
| 9 |
+
# TODO: replace with real analyzer
|
| 10 |
+
return f"✅ File '{file.name}' uploaded successfully! Size: {len(raw_email)} bytes."
|
| 11 |
+
except Exception as e:
|
| 12 |
+
return f"❌ Error: {e}"
|
| 13 |
+
|
| 14 |
+
demo = gr.Interface(
|
| 15 |
+
fn=analyze_eml_file,
|
| 16 |
+
inputs=gr.File(file_types=[".eml"], label="Upload an Email (.eml)"),
|
| 17 |
+
outputs="text",
|
| 18 |
+
title="📧 Email Guardians - Free Email Analyzer",
|
| 19 |
+
description="Upload a .eml file to analyze headers, body, and URLs."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
demo.launch()
|