Spaces:
Sleeping
Sleeping
Ruslan Magana Vsevolodovna
commited on
Commit
·
e003c33
1
Parent(s):
0922efd
adding more Italian Example
Browse files
app.py
CHANGED
|
@@ -134,17 +134,9 @@ def video_to_translate(url,initial_language,final_language):
|
|
| 134 |
lang='ja'
|
| 135 |
# Initial directory
|
| 136 |
home_dir= os.getenv('home_dir')
|
| 137 |
-
temp_dir = os.getenv('temp_dir')
|
| 138 |
-
#os.chdir(home_dir)
|
| 139 |
print('Initial directory:',home_dir)
|
| 140 |
-
cleanup()
|
| 141 |
-
# Temporal directory
|
| 142 |
-
print('Temporal directory:',temp_dir)
|
| 143 |
-
# Go to temp directory
|
| 144 |
-
#os.chdir(temp_dir)
|
| 145 |
-
#print('Changing temporal directory',os.getcwd())
|
| 146 |
# Cleaning previous files
|
| 147 |
-
|
| 148 |
file_obj=download_video(url)
|
| 149 |
print(file_obj)
|
| 150 |
# Insert Local Video File Path
|
|
@@ -179,8 +171,6 @@ def video_to_translate(url,initial_language,final_language):
|
|
| 179 |
except Exception:
|
| 180 |
print("This video cannot be recognized")
|
| 181 |
cleanup()
|
| 182 |
-
# Return back to main directory
|
| 183 |
-
#os.chdir(home_dir)
|
| 184 |
return "./demo/tryagain.mp4"
|
| 185 |
text=text+text_chunk+" "
|
| 186 |
text=str(text)
|
|
@@ -192,8 +182,6 @@ def video_to_translate(url,initial_language,final_language):
|
|
| 192 |
except Exception:
|
| 193 |
print("This video cannot be recognized")
|
| 194 |
cleanup()
|
| 195 |
-
# Return back to main directory
|
| 196 |
-
#os.chdir(home_dir)
|
| 197 |
return "./demo/tryagain.mp4"
|
| 198 |
|
| 199 |
#print(text)
|
|
@@ -208,8 +196,6 @@ def video_to_translate(url,initial_language,final_language):
|
|
| 208 |
except Exception:
|
| 209 |
print("This text cannot be translated")
|
| 210 |
cleanup()
|
| 211 |
-
# Return back to main directory
|
| 212 |
-
#os.chdir(home_dir)
|
| 213 |
return "./demo/tryagain.mp4"
|
| 214 |
|
| 215 |
#translation.text
|
|
@@ -258,6 +244,7 @@ gr.Interface(fn = video_to_translate,
|
|
| 258 |
["https://www.youtube.com/watch?v=Cu3R5it4cQs&list", "English","Italian"],
|
| 259 |
["https://www.youtube.com/watch?v=fkGCLIQx1MI", "English","Spanish"],
|
| 260 |
["https://www.youtube.com/watch?v=fkGCLIQx1MI", "English","Russian"],
|
|
|
|
| 261 |
["https://www.youtube.com/watch?v=QbkhvLrlex4", "Russian","English"],
|
| 262 |
["https://www.youtube.com/watch?v=qzzweIQoIOU", "Japanese","English"],
|
| 263 |
["https://www.youtube.com/watch?v=nOGZvu6tJFE", "German","Spanish"]
|
|
|
|
| 134 |
lang='ja'
|
| 135 |
# Initial directory
|
| 136 |
home_dir= os.getenv('home_dir')
|
|
|
|
|
|
|
| 137 |
print('Initial directory:',home_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
# Cleaning previous files
|
| 139 |
+
cleanup()
|
| 140 |
file_obj=download_video(url)
|
| 141 |
print(file_obj)
|
| 142 |
# Insert Local Video File Path
|
|
|
|
| 171 |
except Exception:
|
| 172 |
print("This video cannot be recognized")
|
| 173 |
cleanup()
|
|
|
|
|
|
|
| 174 |
return "./demo/tryagain.mp4"
|
| 175 |
text=text+text_chunk+" "
|
| 176 |
text=str(text)
|
|
|
|
| 182 |
except Exception:
|
| 183 |
print("This video cannot be recognized")
|
| 184 |
cleanup()
|
|
|
|
|
|
|
| 185 |
return "./demo/tryagain.mp4"
|
| 186 |
|
| 187 |
#print(text)
|
|
|
|
| 196 |
except Exception:
|
| 197 |
print("This text cannot be translated")
|
| 198 |
cleanup()
|
|
|
|
|
|
|
| 199 |
return "./demo/tryagain.mp4"
|
| 200 |
|
| 201 |
#translation.text
|
|
|
|
| 244 |
["https://www.youtube.com/watch?v=Cu3R5it4cQs&list", "English","Italian"],
|
| 245 |
["https://www.youtube.com/watch?v=fkGCLIQx1MI", "English","Spanish"],
|
| 246 |
["https://www.youtube.com/watch?v=fkGCLIQx1MI", "English","Russian"],
|
| 247 |
+
["https://www.youtube.com/watch?v=aDGY4ezFR_0", "Italian","English"],
|
| 248 |
["https://www.youtube.com/watch?v=QbkhvLrlex4", "Russian","English"],
|
| 249 |
["https://www.youtube.com/watch?v=qzzweIQoIOU", "Japanese","English"],
|
| 250 |
["https://www.youtube.com/watch?v=nOGZvu6tJFE", "German","Spanish"]
|