Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,15 +16,14 @@ forced_decoder_ids = processor.get_decoder_prompt_ids(language="italian", task="
|
|
16 |
# Custom preprocessing function
|
17 |
def preprocess_audio(audio_data):
|
18 |
# Apply any custom preprocessing to the audio data here if needed
|
19 |
-
|
|
|
|
|
20 |
|
21 |
# Function to perform ASR on audio data
|
22 |
-
def transcribe_audio(
|
23 |
-
# Preprocess the audio data
|
24 |
-
input_features = preprocess_audio(audio_data)
|
25 |
-
|
26 |
# Generate token ids
|
27 |
-
predicted_ids = model.generate(input_features)
|
28 |
|
29 |
# Decode token ids to text
|
30 |
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
|
|
|
16 |
# Custom preprocessing function
|
17 |
def preprocess_audio(audio_data):
|
18 |
# Apply any custom preprocessing to the audio data here if needed
|
19 |
+
# Ensure that the input data is a valid format for the model
|
20 |
+
processed_data = processor(audio_data, return_tensors="pt", padding=True, truncation=True)
|
21 |
+
return processed_data
|
22 |
|
23 |
# Function to perform ASR on audio data
|
24 |
+
def transcribe_audio(input_features):
|
|
|
|
|
|
|
25 |
# Generate token ids
|
26 |
+
predicted_ids = model.generate(**input_features)
|
27 |
|
28 |
# Decode token ids to text
|
29 |
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
|