Update app.py
Browse files
app.py
CHANGED
|
@@ -35,12 +35,17 @@ def predict_pptx_content(file_path):
|
|
| 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 |
-
|
| 39 |
"predicted_label": predicted_label,
|
| 40 |
"evaluation": predicted_probability,
|
| 41 |
"summary": summary
|
| 42 |
}
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
except Exception as e:
|
| 45 |
# Log the error details
|
| 46 |
print(f"Error in predict_pptx_content: {e}")
|
|
|
|
| 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 |
|
| 44 |
+
with open('output.json', 'w') as json_file:
|
| 45 |
+
json.dump(output_dict, json_file)
|
| 46 |
+
|
| 47 |
+
return output_dict
|
| 48 |
+
|
| 49 |
except Exception as e:
|
| 50 |
# Log the error details
|
| 51 |
print(f"Error in predict_pptx_content: {e}")
|