Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -117,6 +117,7 @@ class VibeVoiceDemo:
|
|
| 117 |
print(f"Found {len(self.available_voices)} voice files in {voices_dir}")
|
| 118 |
print(f"Available voices: {', '.join(self.available_voices.keys())}")
|
| 119 |
|
|
|
|
| 120 |
def read_audio(self, audio_path: str, target_sr: int = 24000) -> np.ndarray:
|
| 121 |
"""Read and preprocess audio file."""
|
| 122 |
try:
|
|
@@ -129,6 +130,7 @@ class VibeVoiceDemo:
|
|
| 129 |
except Exception as e:
|
| 130 |
print(f"Error reading audio {audio_path}: {e}")
|
| 131 |
return np.array([])
|
|
|
|
| 132 |
@spaces.GPU
|
| 133 |
def generate_podcast_streaming(self,
|
| 134 |
num_speakers: int,
|
|
@@ -459,6 +461,7 @@ class VibeVoiceDemo:
|
|
| 459 |
# Make sure to end the stream on error
|
| 460 |
audio_streamer.end()
|
| 461 |
|
|
|
|
| 462 |
def stop_audio_generation(self):
|
| 463 |
"""Stop the current audio generation process."""
|
| 464 |
self.stop_generation = True
|
|
@@ -519,7 +522,8 @@ class VibeVoiceDemo:
|
|
| 519 |
print(f"Successfully loaded {len(self.example_scripts)} example scripts")
|
| 520 |
else:
|
| 521 |
print("No example scripts were loaded")
|
| 522 |
-
|
|
|
|
| 523 |
def _get_num_speakers_from_script(self, script: str) -> int:
|
| 524 |
"""Determine the number of unique speakers in a script."""
|
| 525 |
import re
|
|
|
|
| 117 |
print(f"Found {len(self.available_voices)} voice files in {voices_dir}")
|
| 118 |
print(f"Available voices: {', '.join(self.available_voices.keys())}")
|
| 119 |
|
| 120 |
+
@spaces.GPU
|
| 121 |
def read_audio(self, audio_path: str, target_sr: int = 24000) -> np.ndarray:
|
| 122 |
"""Read and preprocess audio file."""
|
| 123 |
try:
|
|
|
|
| 130 |
except Exception as e:
|
| 131 |
print(f"Error reading audio {audio_path}: {e}")
|
| 132 |
return np.array([])
|
| 133 |
+
|
| 134 |
@spaces.GPU
|
| 135 |
def generate_podcast_streaming(self,
|
| 136 |
num_speakers: int,
|
|
|
|
| 461 |
# Make sure to end the stream on error
|
| 462 |
audio_streamer.end()
|
| 463 |
|
| 464 |
+
@spaces.GPU
|
| 465 |
def stop_audio_generation(self):
|
| 466 |
"""Stop the current audio generation process."""
|
| 467 |
self.stop_generation = True
|
|
|
|
| 522 |
print(f"Successfully loaded {len(self.example_scripts)} example scripts")
|
| 523 |
else:
|
| 524 |
print("No example scripts were loaded")
|
| 525 |
+
|
| 526 |
+
@spaces.GPU
|
| 527 |
def _get_num_speakers_from_script(self, script: str) -> int:
|
| 528 |
"""Determine the number of unique speakers in a script."""
|
| 529 |
import re
|