kamau1 commited on
Commit
55fda3b
·
verified ·
1 Parent(s): d3d9b45

Update pages/02_📼_Upload_Video_File.py

Browse files
Files changed (1) hide show
  1. pages/02_📼_Upload_Video_File.py +14 -7
pages/02_📼_Upload_Video_File.py CHANGED
@@ -10,7 +10,7 @@ import numpy as np
10
  import pathlib
11
  import os
12
 
13
- st.set_page_config(page_title="Auto Subtitled Video Generator", page_icon=":movie_camera:", layout="wide")
14
 
15
  # Define a function that we can use to load lottie files from a link.
16
  @st.cache(allow_output_mutation=True)
@@ -40,11 +40,11 @@ with col1:
40
 
41
  with col2:
42
  st.write("""
43
- ## Auto Subtitled Video Generator
44
  ##### Upload a video file and get a video with subtitles.
45
  ###### ➠ If you want to transcribe the video in its original language, select the task as "Transcribe"
46
- ###### ➠ If you want to translate the subtitles to English, select the task as "Translate"
47
- ###### I recommend starting with the base model and then experimenting with the larger models, the small and medium models often work well. """)
48
 
49
 
50
  @st.cache(allow_output_mutation=True)
@@ -114,7 +114,7 @@ def main():
114
  filename = input_file.name[:-4]
115
  else:
116
  filename = None
117
- task = st.selectbox("Select Task", ["Transcribe", "Translate"], index=0)
118
  if task == "Transcribe":
119
  if st.button("Transcribe"):
120
  results = inferecence(loaded_model, input_file, task)
@@ -168,7 +168,7 @@ def main():
168
  st.download_button(label="Download Video with Subtitles",
169
  data=video_with_subs,
170
  file_name=f"{filename}_with_subs.mp4")
171
- elif task == "Translate":
172
  if st.button("Translate to English"):
173
  results = inferecence(loaded_model, input_file, task)
174
  col3, col4 = st.columns(2)
@@ -221,10 +221,17 @@ def main():
221
  st.download_button(label="Download Video with Subtitles ",
222
  data=video_with_subs,
223
  file_name=f"{filename}_with_subs.mp4")
 
 
 
 
 
 
224
  else:
225
  st.error("Please select a task.")
226
 
227
 
228
  if __name__ == "__main__":
229
  main()
230
- st.markdown("###### Made with :heart: by [@BatuhanYılmaz](https://github.com/BatuhanYilmaz26) [![this is an image link](https://i.imgur.com/thJhzOO.png)](https://www.buymeacoffee.com/batuhanylmz)")
 
 
10
  import pathlib
11
  import os
12
 
13
+ st.set_page_config(page_title="Semaitles", page_icon=":movie_camera:", layout="wide")
14
 
15
  # Define a function that we can use to load lottie files from a link.
16
  @st.cache(allow_output_mutation=True)
 
40
 
41
  with col2:
42
  st.write("""
43
+ ## Semaitles
44
  ##### Upload a video file and get a video with subtitles.
45
  ###### ➠ If you want to transcribe the video in its original language, select the task as "Transcribe"
46
+ ###### ➠ If you want to translate the subtitles to English, select the task as "Translate with Whisper"
47
+ ###### If you want to translate the subtitles from English to any of the 200 supported languages, select the task as "Translate with Sema" """)
48
 
49
 
50
  @st.cache(allow_output_mutation=True)
 
114
  filename = input_file.name[:-4]
115
  else:
116
  filename = None
117
+ task = st.selectbox("Select Task", ["Transcribe", "Translate with Whisper", "Translate with Sema"], index=0)
118
  if task == "Transcribe":
119
  if st.button("Transcribe"):
120
  results = inferecence(loaded_model, input_file, task)
 
168
  st.download_button(label="Download Video with Subtitles",
169
  data=video_with_subs,
170
  file_name=f"{filename}_with_subs.mp4")
171
+ elif task == "Translate with Whisper":
172
  if st.button("Translate to English"):
173
  results = inferecence(loaded_model, input_file, task)
174
  col3, col4 = st.columns(2)
 
221
  st.download_button(label="Download Video with Subtitles ",
222
  data=video_with_subs,
223
  file_name=f"{filename}_with_subs.mp4")
224
+
225
+ elif task == "Translate with Sema":
226
+ default_language = "French"
227
+ target = st.selectbox("Select Language", list(flores_codes.keys()), index=list(flores_codes.keys()).index(default_language))
228
+ target_code = flores_codes[target]
229
+
230
  else:
231
  st.error("Please select a task.")
232
 
233
 
234
  if __name__ == "__main__":
235
  main()
236
+ st.markdown("###### ")
237
+ st.markdown("###### Powered by [sema © 2024](https://www.sema.wiki)")