BatuhanYilmaz
commited on
Commit
·
670ecc2
1
Parent(s):
153763d
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ from utils import write_vtt, write_srt
|
|
14 |
|
15 |
st.set_page_config(page_title="YouTube Transcriber", page_icon="🗣", layout="wide")
|
16 |
|
17 |
-
|
18 |
# Define a function that we can use to load lottie files from a link.
|
19 |
@st.cache(allow_output_mutation=True)
|
20 |
def load_lottieurl(url: str):
|
@@ -134,16 +133,16 @@ def main():
|
|
134 |
datatxt = f.read()
|
135 |
|
136 |
|
137 |
-
with open("transcript.
|
138 |
f.writelines(results[1])
|
139 |
f.close()
|
140 |
-
with open(os.path.join(os.getcwd(), "transcript.
|
141 |
datavtt = f.read()
|
142 |
|
143 |
-
with open("transcript.
|
144 |
f.writelines(results[2])
|
145 |
f.close()
|
146 |
-
with open(os.path.join(os.getcwd(), "transcript.
|
147 |
datasrt = f.read()
|
148 |
|
149 |
if st.download_button(label="Download Transcript (.txt)",
|
@@ -161,8 +160,9 @@ def main():
|
|
161 |
file_name=f"{title}.srt"):
|
162 |
st.success("Downloaded Successfully!")
|
163 |
else:
|
164 |
-
|
165 |
st.info("Streamlit refreshes after the download button is clicked. The data is cached so you can download the transcript again without having to transcribe the video again.")
|
|
|
166 |
|
167 |
if __name__ == "__main__":
|
168 |
main()
|
|
|
14 |
|
15 |
st.set_page_config(page_title="YouTube Transcriber", page_icon="🗣", layout="wide")
|
16 |
|
|
|
17 |
# Define a function that we can use to load lottie files from a link.
|
18 |
@st.cache(allow_output_mutation=True)
|
19 |
def load_lottieurl(url: str):
|
|
|
133 |
datatxt = f.read()
|
134 |
|
135 |
|
136 |
+
with open("transcript.vtt", "w+") as f:
|
137 |
f.writelines(results[1])
|
138 |
f.close()
|
139 |
+
with open(os.path.join(os.getcwd(), "transcript.vtt"), "rb") as f:
|
140 |
datavtt = f.read()
|
141 |
|
142 |
+
with open("transcript.srt", "w+") as f:
|
143 |
f.writelines(results[2])
|
144 |
f.close()
|
145 |
+
with open(os.path.join(os.getcwd(), "transcript.srt"), "rb") as f:
|
146 |
datasrt = f.read()
|
147 |
|
148 |
if st.download_button(label="Download Transcript (.txt)",
|
|
|
160 |
file_name=f"{title}.srt"):
|
161 |
st.success("Downloaded Successfully!")
|
162 |
else:
|
163 |
+
st.success("You can download the transcript in .srt format and upload it to YouTube to create subtitles for your video.")
|
164 |
st.info("Streamlit refreshes after the download button is clicked. The data is cached so you can download the transcript again without having to transcribe the video again.")
|
165 |
+
|
166 |
|
167 |
if __name__ == "__main__":
|
168 |
main()
|