artificialguybr commited on
Commit
2275971
β€’
1 Parent(s): b9d4a14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -19,9 +19,6 @@ import torch
19
  import torchvision
20
  from tqdm import tqdm
21
  from numba import jit
22
- import threading
23
- import time
24
- import GPUtil
25
 
26
  os.environ["COQUI_TOS_AGREED"] = "1"
27
 
@@ -39,7 +36,9 @@ def process_video(radio, video, target_language):
39
  video_duration = float(video_info['streams'][0]['duration'])
40
  if video_duration > 90:
41
  return gr.Interface.Warnings("Video duration exceeds 1 minute and 30 seconds. Please upload a shorter video.")
42
-
 
 
43
  run_uuid = uuid.uuid4().hex[:6]
44
 
45
  output_filename = f"{run_uuid}_resized_video.mp4"
@@ -48,8 +47,6 @@ def process_video(radio, video, target_language):
48
 
49
  video_path = output_filename
50
 
51
- #Time tracking
52
- start_time = time.time()
53
  if not os.path.exists(video_path):
54
  return f"Error: {video_path} does not exist."
55
 
@@ -107,12 +104,9 @@ def process_video(radio, video, target_language):
107
  files_to_delete = [
108
  f"{run_uuid}_resized_video.mp4",
109
  f"{run_uuid}_output_audio.wav",
110
- f"{run_uuid}_output_audio_denoised.wav",
111
- f"{run_uuid}_output_audio_processed.wav",
112
  f"{run_uuid}_output_audio_final.wav",
113
  f"{run_uuid}_output_synth.wav"
114
  ]
115
-
116
  for file in files_to_delete:
117
  try:
118
  os.remove(file)
 
19
  import torchvision
20
  from tqdm import tqdm
21
  from numba import jit
 
 
 
22
 
23
  os.environ["COQUI_TOS_AGREED"] = "1"
24
 
 
36
  video_duration = float(video_info['streams'][0]['duration'])
37
  if video_duration > 90:
38
  return gr.Interface.Warnings("Video duration exceeds 1 minute and 30 seconds. Please upload a shorter video.")
39
+ if target_language is None:
40
+ return gr.Interface.Warnings("Please select a Target Language for Dubbing.")
41
+
42
  run_uuid = uuid.uuid4().hex[:6]
43
 
44
  output_filename = f"{run_uuid}_resized_video.mp4"
 
47
 
48
  video_path = output_filename
49
 
 
 
50
  if not os.path.exists(video_path):
51
  return f"Error: {video_path} does not exist."
52
 
 
104
  files_to_delete = [
105
  f"{run_uuid}_resized_video.mp4",
106
  f"{run_uuid}_output_audio.wav",
 
 
107
  f"{run_uuid}_output_audio_final.wav",
108
  f"{run_uuid}_output_synth.wav"
109
  ]
 
110
  for file in files_to_delete:
111
  try:
112
  os.remove(file)