Update app.py
Browse files
app.py
CHANGED
@@ -85,8 +85,13 @@ if audio_file:
|
|
85 |
# ================================
|
86 |
# ✅ Fast Transcription Processing with Conformer
|
87 |
# ================================
|
|
|
88 |
inputs = processor(denoised_waveform.numpy(), sampling_rate=sr, return_tensors="pt", padding=True).to("cuda" if torch.cuda.is_available() else "cpu")
|
89 |
|
|
|
|
|
|
|
|
|
90 |
with torch.no_grad():
|
91 |
logits = model(**inputs).logits
|
92 |
|
|
|
85 |
# ================================
|
86 |
# ✅ Fast Transcription Processing with Conformer
|
87 |
# ================================
|
88 |
+
# Convert waveform into the required format
|
89 |
inputs = processor(denoised_waveform.numpy(), sampling_rate=sr, return_tensors="pt", padding=True).to("cuda" if torch.cuda.is_available() else "cpu")
|
90 |
|
91 |
+
# Make sure the input has batch dimension (even if it's one example)
|
92 |
+
if len(inputs.input_values.shape) == 1:
|
93 |
+
inputs.input_values = inputs.input_values.unsqueeze(0)
|
94 |
+
|
95 |
with torch.no_grad():
|
96 |
logits = model(**inputs).logits
|
97 |
|