Update custom_interface_app.py
Browse files- custom_interface_app.py +7 -3
custom_interface_app.py
CHANGED
@@ -132,10 +132,14 @@ class ASR(Pretrained):
|
|
132 |
|
133 |
# Add the last segment
|
134 |
segments.append([current_start, current_end])
|
135 |
-
|
136 |
-
outputs = []
|
137 |
# Process each segment
|
|
|
138 |
for i, segment in enumerate(segments):
|
|
|
|
|
|
|
|
|
139 |
print(f"Processing segment {i + 1}/{len(segments)}, length: {len(segment) / sr:.2f} seconds")
|
140 |
|
141 |
# import soundfile as sf
|
@@ -159,4 +163,4 @@ class ASR(Pretrained):
|
|
159 |
rel_length = torch.tensor([1.0]).to(device)
|
160 |
# outputs.append(self.encode_batch_whisper(device, batch, rel_length))
|
161 |
outputs = self.encode_batch_whisper(device, batch, rel_length)
|
162 |
-
yield outputs
|
|
|
132 |
|
133 |
# Add the last segment
|
134 |
segments.append([current_start, current_end])
|
135 |
+
|
|
|
136 |
# Process each segment
|
137 |
+
outputs = []
|
138 |
for i, segment in enumerate(segments):
|
139 |
+
start, end = segment
|
140 |
+
start = int(start * sr)
|
141 |
+
end = int(end * sr)
|
142 |
+
segment = waveform[start:end]
|
143 |
print(f"Processing segment {i + 1}/{len(segments)}, length: {len(segment) / sr:.2f} seconds")
|
144 |
|
145 |
# import soundfile as sf
|
|
|
163 |
rel_length = torch.tensor([1.0]).to(device)
|
164 |
# outputs.append(self.encode_batch_whisper(device, batch, rel_length))
|
165 |
outputs = self.encode_batch_whisper(device, batch, rel_length)
|
166 |
+
yield outputs
|