Ahmed235 commited on
Commit
b246175
·
verified ·
1 Parent(s): ecd8fcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -17,13 +17,13 @@ def extract_text_from_pptx(file_path):
17
  def predict_pptx_content(file_path):
18
  try:
19
  extracted_text = extract_text_from_pptx(file_path)
20
-
21
  # Perform inference using the pipeline
22
  result = classifier(extracted_text)
23
 
24
  predicted_label = result[0]['label']
25
  predicted_probability = result[0]['score']
26
-
27
  prediction = {
28
  "Evaluation": f"Evaluate the topic according to {predicted_label} is: {predicted_probability}",
29
  "Summary": summary
 
17
  def predict_pptx_content(file_path):
18
  try:
19
  extracted_text = extract_text_from_pptx(file_path)
20
+ cleaned_text = re.sub(r'\s+', ' ', extracted_text)
21
  # Perform inference using the pipeline
22
  result = classifier(extracted_text)
23
 
24
  predicted_label = result[0]['label']
25
  predicted_probability = result[0]['score']
26
+ summary = summarizer(extracted_text, max_length=80, min_length=30, do_sample=False)[0]['summary_text']
27
  prediction = {
28
  "Evaluation": f"Evaluate the topic according to {predicted_label} is: {predicted_probability}",
29
  "Summary": summary