Spaces:
Running
on
Zero
Running
on
Zero
artificialguybr
commited on
Commit
•
6e0e19c
1
Parent(s):
923fdda
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,30 @@ ZipFile("ffmpeg.zip").extractall()
|
|
27 |
st = os.stat('ffmpeg')
|
28 |
os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
print("Starting the program...")
|
31 |
|
32 |
def generate_unique_filename(extension):
|
@@ -131,28 +155,6 @@ def process_video(radio, video, target_language, has_closeup_face):
|
|
131 |
whisper_text = transcribe_audio(f"{run_uuid}_output_audio_final.wav")
|
132 |
print(f"Transcription successful: {whisper_text}")
|
133 |
|
134 |
-
language_mapping = {
|
135 |
-
'English': ('en', 'en-US-EricNeural'),
|
136 |
-
'Spanish': ('es', 'es-ES-AlvaroNeural'),
|
137 |
-
'French': ('fr', 'fr-FR-HenriNeural'),
|
138 |
-
'German': ('de', 'de-DE-ConradNeural'),
|
139 |
-
'Italian': ('it', 'it-IT-DiegoNeural'),
|
140 |
-
'Portuguese': ('pt', 'pt-PT-DuarteNeural'),
|
141 |
-
'Polish': ('pl', 'pl-PL-MarekNeural'),
|
142 |
-
'Turkish': ('tr', 'tr-TR-AhmetNeural'),
|
143 |
-
'Russian': ('ru', 'ru-RU-DmitryNeural'),
|
144 |
-
'Dutch': ('nl', 'nl-NL-MaartenNeural'),
|
145 |
-
'Czech': ('cs', 'cs-CZ-AntoninNeural'),
|
146 |
-
'Arabic': ('ar', 'ar-SA-HamedNeural'),
|
147 |
-
'Chinese (Simplified)': ('zh-CN', 'zh-CN-YunxiNeural'),
|
148 |
-
'Japanese': ('ja', 'ja-JP-KeitaNeural'),
|
149 |
-
'Korean': ('ko', 'ko-KR-InJoonNeural'),
|
150 |
-
'Hindi': ('hi', 'hi-IN-MadhurNeural'),
|
151 |
-
'Swedish': ('sv', 'sv-SE-MattiasNeural'),
|
152 |
-
'Danish': ('da', 'da-DK-JeppeNeural'),
|
153 |
-
'Finnish': ('fi', 'fi-FI-HarriNeural'),
|
154 |
-
'Greek': ('el', 'el-GR-NestorasNeural')
|
155 |
-
}
|
156 |
target_language_code, voice = language_mapping[target_language]
|
157 |
translator = Translator()
|
158 |
translated_text = translator.translate(whisper_text, dest=target_language_code).text
|
|
|
27 |
st = os.stat('ffmpeg')
|
28 |
os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
29 |
|
30 |
+
language_mapping = {
|
31 |
+
'English': ('en', 'en-US-EricNeural'),
|
32 |
+
'Spanish': ('es', 'es-ES-AlvaroNeural'),
|
33 |
+
'French': ('fr', 'fr-FR-HenriNeural'),
|
34 |
+
'German': ('de', 'de-DE-ConradNeural'),
|
35 |
+
'Italian': ('it', 'it-IT-DiegoNeural'),
|
36 |
+
'Portuguese': ('pt', 'pt-PT-DuarteNeural'),
|
37 |
+
'Polish': ('pl', 'pl-PL-MarekNeural'),
|
38 |
+
'Turkish': ('tr', 'tr-TR-AhmetNeural'),
|
39 |
+
'Russian': ('ru', 'ru-RU-DmitryNeural'),
|
40 |
+
'Dutch': ('nl', 'nl-NL-MaartenNeural'),
|
41 |
+
'Czech': ('cs', 'cs-CZ-AntoninNeural'),
|
42 |
+
'Arabic': ('ar', 'ar-SA-HamedNeural'),
|
43 |
+
'Chinese (Simplified)': ('zh-CN', 'zh-CN-YunxiNeural'),
|
44 |
+
'Japanese': ('ja', 'ja-JP-KeitaNeural'),
|
45 |
+
'Korean': ('ko', 'ko-KR-InJoonNeural'),
|
46 |
+
'Hindi': ('hi', 'hi-IN-MadhurNeural'),
|
47 |
+
'Swedish': ('sv', 'sv-SE-MattiasNeural'),
|
48 |
+
'Danish': ('da', 'da-DK-JeppeNeural'),
|
49 |
+
'Finnish': ('fi', 'fi-FI-HarriNeural'),
|
50 |
+
'Greek': ('el', 'el-GR-NestorasNeural')
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
print("Starting the program...")
|
55 |
|
56 |
def generate_unique_filename(extension):
|
|
|
155 |
whisper_text = transcribe_audio(f"{run_uuid}_output_audio_final.wav")
|
156 |
print(f"Transcription successful: {whisper_text}")
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
target_language_code, voice = language_mapping[target_language]
|
159 |
translator = Translator()
|
160 |
translated_text = translator.translate(whisper_text, dest=target_language_code).text
|