abunaim1 commited on
Commit
84fe1e1
·
1 Parent(s): de07c97

little changes

Browse files
Files changed (3) hide show
  1. .DS_Store +0 -0
  2. .gitignore +1 -0
  3. app.py +8 -8
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ Improve Your English with Positive News-French Clean Power Ep 800-69274d.mp3
app.py CHANGED
@@ -10,8 +10,10 @@ model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
10
 
11
  def transcribe_audio(audio_path):
12
  try:
13
- audio,sampling_rate = librosa.load(audio_path, sampling_rate=16000)
14
- input_values = processor(audio, return_tensors='pt', sampling_rate=16000).input_values
 
 
15
 
16
  with torch.no_grad():
17
  logits = model(input_values).logits
@@ -23,12 +25,10 @@ def transcribe_audio(audio_path):
23
  return str(e)
24
 
25
  demo = gr.Interface(
26
- fn = transcribe_audio,
27
- inputs= gr.Audio(type='filepath'),
28
  outputs='text',
29
- title="Subtitle Genarator",
30
- description="This tool transcribes audio file into text"
31
  )
32
  demo.launch()
33
-
34
-
 
10
 
11
  def transcribe_audio(audio_path):
12
  try:
13
+ # 'sr' = 'sampling_rate'
14
+ audio, sr = librosa.load(audio_path, sr=16000)
15
+
16
+ input_values = processor(audio, return_tensors='pt', sampling_rate=sr).input_values
17
 
18
  with torch.no_grad():
19
  logits = model(input_values).logits
 
25
  return str(e)
26
 
27
  demo = gr.Interface(
28
+ fn=transcribe_audio,
29
+ inputs=gr.Audio(type='filepath'),
30
  outputs='text',
31
+ title="Subtitle Generator",
32
+ description="This tool transcribes audio files into text"
33
  )
34
  demo.launch()