tahirsher commited on
Commit
eda3536
Β·
verified Β·
1 Parent(s): 2ff2cbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
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
- # Ensure the input has batch dimension (even if it's one example)
89
- input_features = inputs["input_features"].to("cuda" if torch.cuda.is_available() else "cpu")
 
 
 
 
 
 
 
 
 
 
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