sathwikabhavaraju2005 commited on
Commit
7ae9ca8
·
verified ·
1 Parent(s): a6a7a20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -60,11 +60,13 @@ def speech_answer(audio_file_path):
60
  # ------------------------------
61
  # Summarizer
62
  # ------------------------------
 
 
 
 
63
  def summarize_text(text):
64
- input_text = f"summarize: {text.strip()}"
65
- input_ids = tokenizer_qg.encode(input_text, return_tensors="pt", max_length=512, truncation=True)
66
- summary_ids = model_qg.generate(input_ids, max_length=150, min_length=30, length_penalty=5.0, num_beams=2)
67
- return tokenizer_qg.decode(summary_ids[0], skip_special_tokens=True)
68
 
69
  # ------------------------------
70
  # Engagement Predictor (Mock)
 
60
  # ------------------------------
61
  # Summarizer
62
  # ------------------------------
63
+ from transformers import pipeline
64
+
65
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
66
+
67
  def summarize_text(text):
68
+ summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
69
+ return summary[0]['summary_text']
 
 
70
 
71
  # ------------------------------
72
  # Engagement Predictor (Mock)