Ofiroz91 commited on
Commit
d7ce9f8
ยท
verified ยท
1 Parent(s): c2e4987

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -8,8 +8,8 @@ from transformers import pipeline
8
  # ื”ื’ื“ืจืช ื”ืžื•ื“ืœ ืœืชืžืœื•ืœ
9
  model = WhisperModel("ivrit-ai/faster-whisper-v2-d4")
10
 
11
- # ื”ื’ื“ืจืช pipeline ืœืกื™ื›ื•ื
12
- summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
13
 
14
  def transcribe_and_summarize(file_path):
15
  try:
@@ -23,10 +23,9 @@ def transcribe_and_summarize(file_path):
23
  segments, _ = model.transcribe(audio_file, language="he")
24
  transcript = " ".join([segment.text for segment in segments])
25
 
26
- # ืกื™ื›ื•ื ื”ืชืžืœื•ืœ
27
-
28
- summary = summarizer(transcript, max_length=50, min_length=25, do_sample=False)[0]["summary_text"]
29
- prompt_text = f"ืกื›ื ืืช ื”ืชืžืœื•ืœ ื”ื‘ื ื›ืฉื™ืขื•ืจ ืืงื“ืžื™ ื‘ืขื‘ืจื™ืช:\n{transcript}"
30
  # ืžื—ื™ืงืช ืงื•ื‘ืฅ ื”ืื•ื“ื™ื• ื‘ืžื™ื“ืช ื”ืฆื•ืจืš (ืื ื”ื™ื” ื•ื™ื“ืื•)
31
  if audio_file != file_path:
32
  os.remove(audio_file)
 
8
  # ื”ื’ื“ืจืช ื”ืžื•ื“ืœ ืœืชืžืœื•ืœ
9
  model = WhisperModel("ivrit-ai/faster-whisper-v2-d4")
10
 
11
+ # ื”ื’ื“ืจืช pipeline ืœืกื™ื›ื•ื ืขื ืžื•ื“ืœ ืžื•ืชืื ืœืขื‘ืจื™ืช
12
+ summarizer = pipeline("summarization", model="avichr/heBART")
13
 
14
  def transcribe_and_summarize(file_path):
15
  try:
 
23
  segments, _ = model.transcribe(audio_file, language="he")
24
  transcript = " ".join([segment.text for segment in segments])
25
 
26
+ # ืกื™ื›ื•ื ื”ืชืžืœื•ืœ ืขื ืžื•ื“ืœ ื‘ืขื‘ืจื™ืช
27
+ summary = summarizer(transcript)[0]["summary_text"]
28
+
 
29
  # ืžื—ื™ืงืช ืงื•ื‘ืฅ ื”ืื•ื“ื™ื• ื‘ืžื™ื“ืช ื”ืฆื•ืจืš (ืื ื”ื™ื” ื•ื™ื“ืื•)
30
  if audio_file != file_path:
31
  os.remove(audio_file)