juan-op commited on
Commit
b3288d1
·
1 Parent(s): 29eb72e

Minor fixes

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from tempfile import TemporaryDirectory
 
2
 
3
  from pytube import YouTube
4
  import whisper
@@ -19,7 +20,7 @@ def download_audio(url: str, path: str) -> None:
19
  audio.download(output_path=path, filename="a.mp4")
20
 
21
 
22
- def transcribe(path: str) -> list[str]:
23
  """Transcribes the audio file at the given path and returns the text."""
24
  model = whisper.load_model("base")
25
  transcription = model.transcribe(path)["text"]
@@ -27,7 +28,7 @@ def transcribe(path: str) -> list[str]:
27
  return transcription_chunks
28
 
29
 
30
- def summarize(transcription: list[str]) -> str:
31
  """Summarizes the given text and returns the summary."""
32
  model = pipeline("summarization")
33
  summary_chunks = model(transcription, max_length=80, min_length=30)
 
1
  from tempfile import TemporaryDirectory
2
+ from typing import List
3
 
4
  from pytube import YouTube
5
  import whisper
 
20
  audio.download(output_path=path, filename="a.mp4")
21
 
22
 
23
+ def transcribe(path: str) -> List[str]:
24
  """Transcribes the audio file at the given path and returns the text."""
25
  model = whisper.load_model("base")
26
  transcription = model.transcribe(path)["text"]
 
28
  return transcription_chunks
29
 
30
 
31
+ def summarize(transcription: List[str]) -> str:
32
  """Summarizes the given text and returns the summary."""
33
  model = pipeline("summarization")
34
  summary_chunks = model(transcription, max_length=80, min_length=30)