ruslanmv commited on
Commit
06db6da
1 Parent(s): caf73b7

adding Portuguese

Browse files

adding Portuguese by request

Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -26,6 +26,8 @@ def video_to_translate(file_obj,initial_language,final_language):
26
  lang_in='de-DE'
27
  elif initial_language == "Japanese":
28
  lang_in='ja-JP'
 
 
29
  # open the file
30
  with sr.AudioFile("test.wav") as source:
31
  # listen for the data (load audio to memory)
@@ -44,7 +46,9 @@ def video_to_translate(file_obj,initial_language,final_language):
44
  elif final_language == "German":
45
  lang='de'
46
  elif final_language == "Japanese":
47
- lang='ja'
 
 
48
  print(lang)
49
  # init the Google API translator
50
  translator = Translator()
@@ -64,8 +68,8 @@ def video_to_translate(file_obj,initial_language,final_language):
64
  #return 'audio.wav'
65
  return new_video
66
 
67
- initial_language = gr.inputs.Dropdown(["English","Italian","Japanese","Russian","Spanish","German"])
68
- final_language = gr.inputs.Dropdown([ "Russian","Italian","Spanish","German","English","Japanese"])
69
 
70
 
71
  gr.Interface(fn = video_to_translate,
@@ -73,7 +77,7 @@ gr.Interface(fn = video_to_translate,
73
  outputs = 'video',
74
  verbose = True,
75
  title = 'Video Translator',
76
- description = 'A simple application that translates from English, Italian, Japanese, Russian, Spanish, and German video files to Italian, Spanish, Russian, English and Japanese. Upload your own file, or click one of the examples to load them. Wait one minute to process.',
77
  article =
78
  '''<div>
79
  <p style="text-align: center"> All you need to do is to upload the mp4 file and hit submit, then wait for compiling. After that click on Play/Pause for listing to the video. The video is saved in an mp4 format.
@@ -83,6 +87,7 @@ gr.Interface(fn = video_to_translate,
83
  # examples=[['obama.mp4',"English",'Spanish'],
84
  # ['obama.mp4',"English",'Italian'],
85
  # ['obama.mp4',"English",'German'],
86
- # ['obama.mp4',"English",'Japanese']
 
87
  # ]
88
  ).launch()
 
26
  lang_in='de-DE'
27
  elif initial_language == "Japanese":
28
  lang_in='ja-JP'
29
+ elif final_language == "Portuguese":
30
+ lang='pt'
31
  # open the file
32
  with sr.AudioFile("test.wav") as source:
33
  # listen for the data (load audio to memory)
 
46
  elif final_language == "German":
47
  lang='de'
48
  elif final_language == "Japanese":
49
+ lang='ja'
50
+ elif initial_language == "Portuguese":
51
+ lang_in='pt-BR'
52
  print(lang)
53
  # init the Google API translator
54
  translator = Translator()
 
68
  #return 'audio.wav'
69
  return new_video
70
 
71
+ initial_language = gr.inputs.Dropdown(["English","Italian","Japanese","Russian","Spanish","German","Portuguese"])
72
+ final_language = gr.inputs.Dropdown([ "Russian","Italian","Spanish","German","English","Japanese","Portuguese"])
73
 
74
 
75
  gr.Interface(fn = video_to_translate,
 
77
  outputs = 'video',
78
  verbose = True,
79
  title = 'Video Translator',
80
+ description = 'A simple application that translates from English, Italian, Japanese, Russian, Spanish, Portuguese and German video files to Italian, Spanish, Russian, English , Portuguese and Japanese. Upload your own file, or click one of the examples to load them. Wait one minute to process.',
81
  article =
82
  '''<div>
83
  <p style="text-align: center"> All you need to do is to upload the mp4 file and hit submit, then wait for compiling. After that click on Play/Pause for listing to the video. The video is saved in an mp4 format.
 
87
  # examples=[['obama.mp4',"English",'Spanish'],
88
  # ['obama.mp4',"English",'Italian'],
89
  # ['obama.mp4',"English",'German'],
90
+ # ['obama.mp4',"English",'Japanese'],
91
+ # ['obama.mp4',"English",'Portuguese']
92
  # ]
93
  ).launch()