princemaxp commited on
Commit
704f144
·
verified ·
1 Parent(s): a252c82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
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(file_obj):
6
  try:
7
- # Write uploaded file to a temporary .eml file
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="file", label="Upload .eml file"),
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."