Update app.py
Browse files
app.py
CHANGED
@@ -33,13 +33,14 @@ def predict_pptx_content(file_path):
|
|
33 |
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
-
summary = summarizer(extracted_text, max_length=
|
37 |
|
38 |
-
|
39 |
"predicted_label": predicted_label,
|
40 |
"evaluation": predicted_probability,
|
41 |
"summary": summary
|
42 |
}
|
|
|
43 |
|
44 |
except Exception as e:
|
45 |
# Log the error details
|
@@ -50,12 +51,10 @@ def predict_pptx_content(file_path):
|
|
50 |
iface = gr.Interface(
|
51 |
fn=predict_pptx_content,
|
52 |
inputs=gr.File(type="file", label="Upload PowerPoint (.pptx) file"),
|
53 |
-
outputs=
|
54 |
-
gr.Textbox("Output"),
|
55 |
-
],
|
56 |
live=False,
|
57 |
title="<h1 style='color: lightgreen; text-align: center;'>HackTalk Analyzer</h1>",
|
58 |
)
|
59 |
|
60 |
# Deploy the Gradio interface
|
61 |
-
iface.launch(share=True)
|
|
|
33 |
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
+
summary = summarizer(extracted_text, max_length=1000, min_length=30, do_sample=False)[0]['summary_text']
|
37 |
|
38 |
+
output_dict = {
|
39 |
"predicted_label": predicted_label,
|
40 |
"evaluation": predicted_probability,
|
41 |
"summary": summary
|
42 |
}
|
43 |
+
return str(output_dict) # Convert dictionary to string for output
|
44 |
|
45 |
except Exception as e:
|
46 |
# Log the error details
|
|
|
51 |
iface = gr.Interface(
|
52 |
fn=predict_pptx_content,
|
53 |
inputs=gr.File(type="file", label="Upload PowerPoint (.pptx) file"),
|
54 |
+
outputs=gr.Textbox("Output"),
|
|
|
|
|
55 |
live=False,
|
56 |
title="<h1 style='color: lightgreen; text-align: center;'>HackTalk Analyzer</h1>",
|
57 |
)
|
58 |
|
59 |
# Deploy the Gradio interface
|
60 |
+
iface.launch(share=True)
|