Spaces:
Runtime error
Runtime error
add gpu usage
Browse files- app.py +4 -0
- requirements.txt +2 -1
app.py
CHANGED
@@ -7,6 +7,8 @@ from datetime import datetime
|
|
7 |
import time
|
8 |
import psutil
|
9 |
from mtranslate import translate
|
|
|
|
|
10 |
|
11 |
MODEL_NAME = "cahya/whisper-medium-id" # this always needs to stay in line 8 :D sorry for the hackiness
|
12 |
lang = "id"
|
@@ -91,9 +93,11 @@ def tts(language: str, audio_microphone: str, audio_file: str):
|
|
91 |
time_end = time.time()
|
92 |
time_diff = time_end - time_start
|
93 |
memory = psutil.virtual_memory()
|
|
|
94 |
system_info = f"""
|
95 |
*Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
|
96 |
*Processing time: {time_diff:.5} seconds*
|
|
|
97 |
"""
|
98 |
print(f"### {datetime.now()} fp.name:", fp.name)
|
99 |
return transcription, translation, fp.name, system_info
|
|
|
7 |
import time
|
8 |
import psutil
|
9 |
from mtranslate import translate
|
10 |
+
from gpuinfo import GPUInfo
|
11 |
+
|
12 |
|
13 |
MODEL_NAME = "cahya/whisper-medium-id" # this always needs to stay in line 8 :D sorry for the hackiness
|
14 |
lang = "id"
|
|
|
93 |
time_end = time.time()
|
94 |
time_diff = time_end - time_start
|
95 |
memory = psutil.virtual_memory()
|
96 |
+
gpu_utilization, gpu_memory = GPUInfo.gpu_usage()
|
97 |
system_info = f"""
|
98 |
*Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
|
99 |
*Processing time: {time_diff:.5} seconds*
|
100 |
+
*GPU Utilization: {gpu_utilization[0]}%, GPU Memory: {gpu_memory[0]}MiB.*
|
101 |
"""
|
102 |
print(f"### {datetime.now()} fp.name:", fp.name)
|
103 |
return transcription, translation, fp.name, system_info
|
requirements.txt
CHANGED
@@ -2,4 +2,5 @@ git+https://github.com/huggingface/transformers
|
|
2 |
torch
|
3 |
neon-tts-plugin-coqui==0.6.0
|
4 |
psutil
|
5 |
-
mtranslate
|
|
|
|
2 |
torch
|
3 |
neon-tts-plugin-coqui==0.6.0
|
4 |
psutil
|
5 |
+
mtranslate
|
6 |
+
gpuinfo
|