File size: 1,519 Bytes
9a2b6d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# """Mock TTS implementation for local development"""
# import numpy as np

# class MockTTSModel:
#     def __init__(self):
#         self.model = None
        
#     def initialize(self):
#         """Mock initialization"""
#         self.model = "mock_model"
#         return True
        
#     def list_voices(self):
#         """Return mock list of voices"""
#         return ["mock_voice_1", "mock_voice_2"]
        
#     def generate_speech(self, text, voice_names, speed, gpu_timeout=90, progress_callback=None, progress_state=None, progress=None):
#         """Generate mock audio data"""
#         # Create mock audio data (1 second of silence)
#         sample_rate = 22050
#         duration = 1.0
#         t = np.linspace(0, duration, int(sample_rate * duration))
#         audio_array = np.zeros_like(t)
        
#         # Mock metrics
#         metrics = {
#             "tokens_per_sec": [10.5, 11.2, 10.8],
#             "rtf": [0.5, 0.48, 0.52],
#             "total_time": 3,
#             "total_tokens": 100
#         }
        
#         # Simulate progress updates
#         if progress_callback and progress_state and progress:
#             for i in range(3):
#                 progress_callback(i+1, 3, metrics["tokens_per_sec"][i], 
#                                 metrics["rtf"][i], progress_state, 
#                                 progress_state.get("start_time", 0),
#                                 gpu_timeout, progress)
        
#         return audio_array, duration, metrics