Spaces:
Runtime error
Runtime error
Commit
·
a6aebb9
1
Parent(s):
c2a3ff4
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import whisper
|
|
6 |
|
7 |
os.system('pip install https://huggingface.co/Armandoliv/es_pipeline/resolve/main/es_pipeline-any-py3-none-any.whl')
|
8 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
|
9 |
nlp_ner = spacy.load("es_pipeline")
|
10 |
|
11 |
def main_generator(youtube_id:str):
|
@@ -13,9 +14,11 @@ def main_generator(youtube_id:str):
|
|
13 |
OutputFile = 'test_audio_youtube_.m4a'
|
14 |
|
15 |
os.system(f"youtube-dl -o {OutputFile} {YouTubeID} --extract-audio --restrict-filenames -f 'bestaudio[ext=m4a]'")
|
16 |
-
|
17 |
result = model_whisper.transcribe(OutputFile)
|
18 |
text = result['text']
|
|
|
|
|
19 |
output_list = []
|
20 |
for ent in doc.ents:
|
21 |
result_dict = {
|
|
|
6 |
|
7 |
os.system('pip install https://huggingface.co/Armandoliv/es_pipeline/resolve/main/es_pipeline-any-py3-none-any.whl')
|
8 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
9 |
+
model_whisper = whisper.load_model("small")
|
10 |
nlp_ner = spacy.load("es_pipeline")
|
11 |
|
12 |
def main_generator(youtube_id:str):
|
|
|
14 |
OutputFile = 'test_audio_youtube_.m4a'
|
15 |
|
16 |
os.system(f"youtube-dl -o {OutputFile} {YouTubeID} --extract-audio --restrict-filenames -f 'bestaudio[ext=m4a]'")
|
17 |
+
|
18 |
result = model_whisper.transcribe(OutputFile)
|
19 |
text = result['text']
|
20 |
+
doc = nlp_ner(text)
|
21 |
+
|
22 |
output_list = []
|
23 |
for ent in doc.ents:
|
24 |
result_dict = {
|