Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,11 +9,11 @@ def html_to_pdf(html_content):
|
|
| 9 |
HTML(string=html_content).write_pdf(tmp_pdf.name)
|
| 10 |
return tmp_pdf.name
|
| 11 |
|
| 12 |
-
def analyze_email(
|
| 13 |
-
if
|
| 14 |
return "<p style='color:red;'>Please upload a .eml file to analyze.</p>", None
|
| 15 |
|
| 16 |
-
results = analyze(
|
| 17 |
|
| 18 |
# Basic verdict info
|
| 19 |
attack_score = results[0]
|
|
@@ -93,7 +93,7 @@ def analyze_email(file_obj, export_pdf=False):
|
|
| 93 |
demo = gr.Interface(
|
| 94 |
fn=analyze_email,
|
| 95 |
inputs=[
|
| 96 |
-
gr.File(label="Upload .eml File", type="
|
| 97 |
gr.Checkbox(label="Export PDF Report")
|
| 98 |
],
|
| 99 |
outputs=[
|
|
|
|
| 9 |
HTML(string=html_content).write_pdf(tmp_pdf.name)
|
| 10 |
return tmp_pdf.name
|
| 11 |
|
| 12 |
+
def analyze_email(file_path, export_pdf=False):
|
| 13 |
+
if file_path is None:
|
| 14 |
return "<p style='color:red;'>Please upload a .eml file to analyze.</p>", None
|
| 15 |
|
| 16 |
+
results = analyze(file_path)
|
| 17 |
|
| 18 |
# Basic verdict info
|
| 19 |
attack_score = results[0]
|
|
|
|
| 93 |
demo = gr.Interface(
|
| 94 |
fn=analyze_email,
|
| 95 |
inputs=[
|
| 96 |
+
gr.File(label="Upload .eml File", type="filepath"),
|
| 97 |
gr.Checkbox(label="Export PDF Report")
|
| 98 |
],
|
| 99 |
outputs=[
|