Update app.py
Browse files
app.py
CHANGED
@@ -34,13 +34,17 @@ def predict_pptx_content(file_path):
|
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
summary = summarizer(extracted_text, max_length=80, min_length=30, do_sample=False)[0]['summary_text']
|
37 |
-
prediction_1 = "Predicted_Label: " + str(predicted_label)
|
38 |
-
prediction_2 = "Evaluation: Evaluate the topic according to " + str(predicted_label) + " is: " + str(predicted_probability)
|
39 |
-
prediction_3 = "Summary: " + str(summary)
|
40 |
-
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
|
|
|
|
|
|
44 |
|
45 |
except Exception as e:
|
46 |
# Log the error details
|
|
|
34 |
predicted_label = result[0]['label']
|
35 |
predicted_probability = result[0]['score']
|
36 |
summary = summarizer(extracted_text, max_length=80, min_length=30, do_sample=False)[0]['summary_text']
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
return {
|
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}")
|
47 |
+
return {"error": str(e)}
|
48 |
|
49 |
except Exception as e:
|
50 |
# Log the error details
|