Update app.py
Browse files
app.py
CHANGED
@@ -83,10 +83,21 @@ if audio_file:
|
|
83 |
# ================================
|
84 |
# β
Preprocess Audio with Processor (Corrected)
|
85 |
# ================================
|
|
|
86 |
inputs = processor(adversarial_waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt", padding=True)
|
87 |
|
88 |
-
#
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
# ================================
|
92 |
# β
Fast Transcription Processing with Conformer
|
|
|
83 |
# ================================
|
84 |
# β
Preprocess Audio with Processor (Corrected)
|
85 |
# ================================
|
86 |
+
# Ensure the input has batch dimension (even if it's one example)
|
87 |
inputs = processor(adversarial_waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt", padding=True)
|
88 |
|
89 |
+
# Check the structure of the returned `inputs` to understand what it contains
|
90 |
+
st.write("Processor Output:", inputs)
|
91 |
+
|
92 |
+
# Extract the correct key (input_features or input_values depending on the model)
|
93 |
+
if "input_features" in inputs:
|
94 |
+
input_features = inputs["input_features"]
|
95 |
+
elif "input_values" in inputs:
|
96 |
+
input_features = inputs["input_values"]
|
97 |
+
else:
|
98 |
+
raise ValueError("β The processor output does not contain 'input_features' or 'input_values'.")
|
99 |
+
|
100 |
+
input_features = input_features.to("cuda" if torch.cuda.is_available() else "cpu")
|
101 |
|
102 |
# ================================
|
103 |
# β
Fast Transcription Processing with Conformer
|