Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import tempfile
|
| 3 |
from analyze_email_main import analyze_email
|
| 4 |
|
| 5 |
-
def analyze_uploaded_email(
|
| 6 |
try:
|
| 7 |
-
|
| 8 |
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".eml") as tmp:
|
| 9 |
-
tmp.write(file_obj.read())
|
| 10 |
-
tmp_path = tmp.name
|
| 11 |
-
|
| 12 |
-
results = analyze_email(tmp_path)
|
| 13 |
|
| 14 |
if isinstance(results, dict):
|
| 15 |
-
# Format dict output nicely
|
| 16 |
output = []
|
| 17 |
for section, findings in results.items():
|
| 18 |
output.append(f"--- {section.upper()} ---")
|
|
@@ -31,7 +24,7 @@ def analyze_uploaded_email(file_obj):
|
|
| 31 |
|
| 32 |
iface = gr.Interface(
|
| 33 |
fn=analyze_uploaded_email,
|
| 34 |
-
inputs=gr.File(type="
|
| 35 |
outputs="text",
|
| 36 |
title="Email Analysis Tool",
|
| 37 |
description="Upload a .eml file to analyze headers, body, and URLs."
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from analyze_email_main import analyze_email
|
| 3 |
|
| 4 |
+
def analyze_uploaded_email(file_path):
|
| 5 |
try:
|
| 6 |
+
results = analyze_email(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
if isinstance(results, dict):
|
|
|
|
| 9 |
output = []
|
| 10 |
for section, findings in results.items():
|
| 11 |
output.append(f"--- {section.upper()} ---")
|
|
|
|
| 24 |
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=analyze_uploaded_email,
|
| 27 |
+
inputs=gr.File(type="filepath", label="Upload .eml file"),
|
| 28 |
outputs="text",
|
| 29 |
title="Email Analysis Tool",
|
| 30 |
description="Upload a .eml file to analyze headers, body, and URLs."
|