Update functions.py
Browse files- functions.py +3 -3
functions.py
CHANGED
@@ -60,7 +60,7 @@ def get_spacy():
|
|
60 |
return nlp
|
61 |
|
62 |
@st.experimental_memo(suppress_st_warning=True)
|
63 |
-
def inference(link, upload,
|
64 |
'''Convert Youtube video or Audio upload to text'''
|
65 |
|
66 |
if validators.url(link):
|
@@ -68,12 +68,12 @@ def inference(link, upload, asr_model):
|
|
68 |
yt = YouTube(link)
|
69 |
title = yt.title
|
70 |
path = yt.streams.filter(only_audio=True)[0].download(filename="audio.mp4")
|
71 |
-
results =
|
72 |
|
73 |
return results['text'], yt.title
|
74 |
|
75 |
elif upload:
|
76 |
-
results =
|
77 |
|
78 |
return results['text'], "Transcribed Earnings Audio"
|
79 |
|
|
|
60 |
return nlp
|
61 |
|
62 |
@st.experimental_memo(suppress_st_warning=True)
|
63 |
+
def inference(link, upload, _asr_model):
|
64 |
'''Convert Youtube video or Audio upload to text'''
|
65 |
|
66 |
if validators.url(link):
|
|
|
68 |
yt = YouTube(link)
|
69 |
title = yt.title
|
70 |
path = yt.streams.filter(only_audio=True)[0].download(filename="audio.mp4")
|
71 |
+
results = _asr_model.transcribe(path)
|
72 |
|
73 |
return results['text'], yt.title
|
74 |
|
75 |
elif upload:
|
76 |
+
results = _asr_model.trasncribe(upload)
|
77 |
|
78 |
return results['text'], "Transcribed Earnings Audio"
|
79 |
|