Spaces:
Sleeping
Sleeping
Add device change methods
Browse files- sonogram.py +9 -1
sonogram.py
CHANGED
|
@@ -219,4 +219,12 @@ class Sonogram():
|
|
| 219 |
def __call__(self,audioPath):
|
| 220 |
annotation, totalTimeInSeconds, waveform, sampleRate = self.processFile(audioPath)
|
| 221 |
|
| 222 |
-
return annotation, totalTimeInSeconds, waveform, sampleRate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
def __call__(self,audioPath):
|
| 220 |
annotation, totalTimeInSeconds, waveform, sampleRate = self.processFile(audioPath)
|
| 221 |
|
| 222 |
+
return annotation, totalTimeInSeconds, waveform, sampleRate
|
| 223 |
+
|
| 224 |
+
def toDevice():
|
| 225 |
+
self.pipeline.to(self.device)
|
| 226 |
+
print(f"Sonogram moved to {self.device}")
|
| 227 |
+
|
| 228 |
+
def toCPU():
|
| 229 |
+
self.pipeline.to('cpu')
|
| 230 |
+
print(f"Sonogram moved to CPU")
|