Spaces:
Sleeping
Sleeping
Ibrahim Olanigan
commited on
Commit
·
9b538d8
1
Parent(s):
61a06c1
Fix missing library
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import pytube as pt
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import re
|
| 6 |
-
from utils import logtime, load_ffmpeg
|
| 7 |
import whisper
|
| 8 |
from langchain.document_loaders import YoutubeLoader
|
| 9 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
@@ -50,7 +49,7 @@ def extract_youtube_video_id(url):
|
|
| 50 |
else:
|
| 51 |
return None
|
| 52 |
|
| 53 |
-
|
| 54 |
def load_whisper():
|
| 55 |
# if not model:
|
| 56 |
model = whisper.load_model("small")
|
|
@@ -111,7 +110,7 @@ def display():
|
|
| 111 |
# height=200,
|
| 112 |
# value=st.session_state[WHISPER])
|
| 113 |
|
| 114 |
-
|
| 115 |
def download_audio():
|
| 116 |
if st.session_state[URL]:
|
| 117 |
print("Downloading....")
|
|
@@ -127,7 +126,7 @@ def download():
|
|
| 127 |
out = subprocess.run(command, shell=True)
|
| 128 |
print('Download with YT-DLP done!!')
|
| 129 |
|
| 130 |
-
|
| 131 |
def transcribe():
|
| 132 |
loader = YoutubeLoader.from_youtube_url(
|
| 133 |
st.session_state[URL], add_video_info=True)
|
|
@@ -139,7 +138,7 @@ def transcribe():
|
|
| 139 |
# st.session_state[TEXT] = docs[index].page_content
|
| 140 |
st.session_state[TEXT] = write_chunks(docs,"transcript.txt")
|
| 141 |
|
| 142 |
-
|
| 143 |
def write_chunks(docs, filename):
|
| 144 |
full_doc = ''
|
| 145 |
for doc in docs:
|
|
@@ -154,7 +153,6 @@ def write_file(text, filename):
|
|
| 154 |
# return full_doc
|
| 155 |
|
| 156 |
def main():
|
| 157 |
-
# load_ffmpeg()
|
| 158 |
init_state()
|
| 159 |
display()
|
| 160 |
|
|
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import re
|
|
|
|
| 6 |
import whisper
|
| 7 |
from langchain.document_loaders import YoutubeLoader
|
| 8 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
|
| 49 |
else:
|
| 50 |
return None
|
| 51 |
|
| 52 |
+
|
| 53 |
def load_whisper():
|
| 54 |
# if not model:
|
| 55 |
model = whisper.load_model("small")
|
|
|
|
| 110 |
# height=200,
|
| 111 |
# value=st.session_state[WHISPER])
|
| 112 |
|
| 113 |
+
|
| 114 |
def download_audio():
|
| 115 |
if st.session_state[URL]:
|
| 116 |
print("Downloading....")
|
|
|
|
| 126 |
out = subprocess.run(command, shell=True)
|
| 127 |
print('Download with YT-DLP done!!')
|
| 128 |
|
| 129 |
+
|
| 130 |
def transcribe():
|
| 131 |
loader = YoutubeLoader.from_youtube_url(
|
| 132 |
st.session_state[URL], add_video_info=True)
|
|
|
|
| 138 |
# st.session_state[TEXT] = docs[index].page_content
|
| 139 |
st.session_state[TEXT] = write_chunks(docs,"transcript.txt")
|
| 140 |
|
| 141 |
+
|
| 142 |
def write_chunks(docs, filename):
|
| 143 |
full_doc = ''
|
| 144 |
for doc in docs:
|
|
|
|
| 153 |
# return full_doc
|
| 154 |
|
| 155 |
def main():
|
|
|
|
| 156 |
init_state()
|
| 157 |
display()
|
| 158 |
|