Spaces:
Running
on
Zero
Running
on
Zero
artificialguybr
commited on
Commit
•
3fa12f4
1
Parent(s):
ac401be
Update app.py
Browse files
app.py
CHANGED
@@ -29,25 +29,6 @@ ZipFile("ffmpeg.zip").extractall()
|
|
29 |
st = os.stat('ffmpeg')
|
30 |
os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
31 |
|
32 |
-
# Initialize peak usage variables
|
33 |
-
peak_gpu_usage = 0.0
|
34 |
-
peak_vram_usage = 0.0
|
35 |
-
|
36 |
-
# Monitoring function
|
37 |
-
def monitor_gpu_usage():
|
38 |
-
global peak_gpu_usage, peak_vram_usage
|
39 |
-
while True:
|
40 |
-
gpus = GPUtil.getGPUs()
|
41 |
-
for gpu in gpus:
|
42 |
-
peak_gpu_usage = max(peak_gpu_usage, gpu.load)
|
43 |
-
peak_vram_usage = max(peak_vram_usage, gpu.memoryUsed)
|
44 |
-
time.sleep(1) # Check every second
|
45 |
-
|
46 |
-
# Start the monitoring thread
|
47 |
-
monitor_thread = threading.Thread(target=monitor_gpu_usage)
|
48 |
-
monitor_thread.daemon = True
|
49 |
-
monitor_thread.start()
|
50 |
-
|
51 |
#Whisper
|
52 |
model_size = "small"
|
53 |
model = WhisperModel(model_size, device="cuda", compute_type="int8")
|
@@ -138,17 +119,6 @@ def process_video(radio, video, target_language):
|
|
138 |
except FileNotFoundError:
|
139 |
print(f"File {file} not found for deletion.")
|
140 |
|
141 |
-
# Stop the timer
|
142 |
-
end_time = time.time()
|
143 |
-
|
144 |
-
# Calculate and print the time taken
|
145 |
-
time_taken = end_time - start_time
|
146 |
-
print(f"Time taken to process video: {time_taken:.2f} seconds")
|
147 |
-
|
148 |
-
# Display peak usages at the end
|
149 |
-
print(f"Peak GPU usage: {peak_gpu_usage * 100}%")
|
150 |
-
print(f"Peak VRAM usage: {peak_vram_usage}MB")
|
151 |
-
|
152 |
return output_video_path
|
153 |
|
154 |
|
|
|
29 |
st = os.stat('ffmpeg')
|
30 |
os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
#Whisper
|
33 |
model_size = "small"
|
34 |
model = WhisperModel(model_size, device="cuda", compute_type="int8")
|
|
|
119 |
except FileNotFoundError:
|
120 |
print(f"File {file} not found for deletion.")
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
return output_video_path
|
123 |
|
124 |
|