BatuhanYilmaz
commited on
Commit
•
badf5f8
1
Parent(s):
610fa5d
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ with col2:
|
|
36 |
###### I recommend starting with the base model and then experimenting with the larger models, the small and medium models often work well. """)
|
37 |
|
38 |
|
|
|
39 |
def populate_metadata(link):
|
40 |
yt = YouTube(link)
|
41 |
author = yt.author
|
@@ -47,6 +48,7 @@ def populate_metadata(link):
|
|
47 |
return author, title, description, thumbnail, length, views
|
48 |
|
49 |
|
|
|
50 |
def download_video(link):
|
51 |
yt = YouTube(link)
|
52 |
video = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
|
@@ -70,6 +72,7 @@ def change_model(current_size, size):
|
|
70 |
raise Exception("Model size is the same as the current size.")
|
71 |
|
72 |
|
|
|
73 |
def inference(link, loaded_model, task):
|
74 |
yt = YouTube(link)
|
75 |
path = yt.streams.filter(only_audio=True)[0].download(filename="audio.mp4")
|
@@ -91,6 +94,7 @@ def inference(link, loaded_model, task):
|
|
91 |
raise ValueError("Task not supported")
|
92 |
|
93 |
|
|
|
94 |
def getSubs(segments: Iterator[dict], format: str, maxLineWidth: int) -> str:
|
95 |
segmentStream = StringIO()
|
96 |
|
|
|
36 |
###### I recommend starting with the base model and then experimenting with the larger models, the small and medium models often work well. """)
|
37 |
|
38 |
|
39 |
+
@st.cache(allow_output_mutation=True)
|
40 |
def populate_metadata(link):
|
41 |
yt = YouTube(link)
|
42 |
author = yt.author
|
|
|
48 |
return author, title, description, thumbnail, length, views
|
49 |
|
50 |
|
51 |
+
@st.cache(allow_output_mutation=True)
|
52 |
def download_video(link):
|
53 |
yt = YouTube(link)
|
54 |
video = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
|
|
|
72 |
raise Exception("Model size is the same as the current size.")
|
73 |
|
74 |
|
75 |
+
@st.cache(allow_output_mutation=True)
|
76 |
def inference(link, loaded_model, task):
|
77 |
yt = YouTube(link)
|
78 |
path = yt.streams.filter(only_audio=True)[0].download(filename="audio.mp4")
|
|
|
94 |
raise ValueError("Task not supported")
|
95 |
|
96 |
|
97 |
+
@st.cache(allow_output_mutation=True)
|
98 |
def getSubs(segments: Iterator[dict], format: str, maxLineWidth: int) -> str:
|
99 |
segmentStream = StringIO()
|
100 |
|