Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import subprocess
|
| 3 |
import sys
|
|
|
|
| 4 |
def install_libraries():
|
| 5 |
try:
|
| 6 |
subprocess.check_call(['pip', 'install', 'pytube'])
|
|
@@ -26,7 +27,7 @@ def main():
|
|
| 26 |
|
| 27 |
if url:
|
| 28 |
captions, translated_captions, original_file, translated_file = Milestone5API.download_video_transcript(url)
|
| 29 |
-
|
| 30 |
if captions:
|
| 31 |
# Parse captions from the API response
|
| 32 |
for line in captions.split("\n"):
|
|
@@ -45,14 +46,15 @@ def main():
|
|
| 45 |
css = f.read()
|
| 46 |
st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)
|
| 47 |
st.write(
|
| 48 |
-
"<table><tr><th class='timestamp'>Timestamp</th><th class='original'>Original</th></tr>",
|
| 49 |
unsafe_allow_html=True,
|
| 50 |
)
|
| 51 |
|
| 52 |
for i in range(start_index, min(end_index, len(captions_list))):
|
| 53 |
st.write(
|
| 54 |
f"<tr><td class='timestamp'>{captions_list[i]['Timestamp']}</td>"
|
| 55 |
-
f"<td class='original'>{captions_list[i]['Original']}</td>
|
|
|
|
| 56 |
unsafe_allow_html=True,
|
| 57 |
)
|
| 58 |
|
|
@@ -71,4 +73,4 @@ def main():
|
|
| 71 |
st.session_state['start_index'] = start_index
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
-
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import subprocess
|
| 3 |
import sys
|
| 4 |
+
|
| 5 |
def install_libraries():
|
| 6 |
try:
|
| 7 |
subprocess.check_call(['pip', 'install', 'pytube'])
|
|
|
|
| 27 |
|
| 28 |
if url:
|
| 29 |
captions, translated_captions, original_file, translated_file = Milestone5API.download_video_transcript(url)
|
| 30 |
+
|
| 31 |
if captions:
|
| 32 |
# Parse captions from the API response
|
| 33 |
for line in captions.split("\n"):
|
|
|
|
| 46 |
css = f.read()
|
| 47 |
st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)
|
| 48 |
st.write(
|
| 49 |
+
"<table><tr><th class='timestamp'>Timestamp</th><th class='original'>Original</th><th class='translated'>Translated</th></tr>",
|
| 50 |
unsafe_allow_html=True,
|
| 51 |
)
|
| 52 |
|
| 53 |
for i in range(start_index, min(end_index, len(captions_list))):
|
| 54 |
st.write(
|
| 55 |
f"<tr><td class='timestamp'>{captions_list[i]['Timestamp']}</td>"
|
| 56 |
+
f"<td class='original'>{captions_list[i]['Original']}</td>"
|
| 57 |
+
f"<td class='translated'>{translated_captions[i]}</td></tr>",
|
| 58 |
unsafe_allow_html=True,
|
| 59 |
)
|
| 60 |
|
|
|
|
| 73 |
st.session_state['start_index'] = start_index
|
| 74 |
|
| 75 |
if __name__ == "__main__":
|
| 76 |
+
main()
|