Spaces:
Runtime error
Runtime error
juan-op
commited on
Commit
·
dda9803
1
Parent(s):
c45a41e
Changed whisper model to base and NLP model to bart
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def download_audio(url: str, path: str) -> None:
|
|
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("
|
26 |
transcription = model.transcribe(path)["text"]
|
27 |
transcription_chunks = [transcription[i : i + 1000] for i in range(0, len(transcription), 1000)]
|
28 |
return transcription_chunks
|
@@ -30,7 +30,7 @@ def transcribe(path: str) -> List[str]:
|
|
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)
|
35 |
summary = (" ".join([chunks["summary_text"] for chunks in summary_chunks]).strip().replace(" . ", ". "))
|
36 |
return summary
|
|
|
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"]
|
27 |
transcription_chunks = [transcription[i : i + 1000] for i in range(0, len(transcription), 1000)]
|
28 |
return transcription_chunks
|
|
|
30 |
|
31 |
def summarize(transcription: List[str]) -> str:
|
32 |
"""Summarizes the given text and returns the summary."""
|
33 |
+
model = pipeline("summarization", model="facebook/bart-large-cnn")
|
34 |
summary_chunks = model(transcription, max_length=80, min_length=30)
|
35 |
summary = (" ".join([chunks["summary_text"] for chunks in summary_chunks]).strip().replace(" . ", ". "))
|
36 |
return summary
|