jfforero commited on
Commit
11199ea
·
verified ·
1 Parent(s): 22127a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -81,16 +81,17 @@ def generate_image(api_key, text):
81
  ####
82
 
83
  ####
 
84
  import torch
85
  from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
86
- import soundfile as sf
87
 
88
- # Load the pretrained English model and processor
89
- model = Speech2TextForConditionalGeneration.from_pretrained("facebook/s2t-medium-libri-lighten")
90
- processor = Speech2TextProcessor.from_pretrained("facebook/s2t-medium-libri-lighten")
 
91
 
92
  # Load your local audio file
93
- #audio_input, sampling_rate = sf.read("path/to/your/local/audio/file.wav")
94
 
95
  # Convert the audio to PyTorch tensors using the processor
96
  inputs = processor(audio_input, sampling_rate=sampling_rate, return_tensors="pt")
@@ -104,8 +105,8 @@ generated_ids = model.generate(
104
 
105
  # Decode the generated transcription
106
  transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)
107
- print(transcription)
108
- ####
109
 
110
 
111
 
 
81
  ####
82
 
83
  ####
84
+
85
  import torch
86
  from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
 
87
 
88
+
89
+ # Load the pretrained model and processor
90
+ model = Speech2TextForConditionalGeneration.from_pretrained("facebook/s2t-small-librispeech-asr")
91
+ processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
92
 
93
  # Load your local audio file
94
+ audio_input, sampling_rate = sf.read("/content/1001_IEO_DIS_HI.wav")
95
 
96
  # Convert the audio to PyTorch tensors using the processor
97
  inputs = processor(audio_input, sampling_rate=sampling_rate, return_tensors="pt")
 
105
 
106
  # Decode the generated transcription
107
  transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)
108
+
109
+ ###
110
 
111
 
112