WajeehAzeemX commited on
Commit
7ea0248
·
verified ·
1 Parent(s): 76b2bae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -33,14 +33,14 @@ async def transcribe_audio(request: Request):
33
  # Convert binary data to a file-like object
34
  audio_file = io.BytesIO(audio_data)
35
  # # Load the audio file using pydub
36
- # audio_array, sampling_rate = librosa.load(audio_file, sr=16000)
37
  # # Process the audio array
38
  # input_features = processor(audio_array, sampling_rate=sampling_rate, return_tensors="pt").input_features
39
  # # Generate token ids
40
  # predicted_ids = model.generate(input_features)
41
  # # Decode token ids to text
42
  # transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
43
- transcription = pipe(audio_file,generate_kwargs = {"task":"transcribe", "language":"<|ar|>"})
44
  # Print the transcription
45
  print(transcription)
46
  print(transcription[0]) # Display the transcriptiontry:
 
33
  # Convert binary data to a file-like object
34
  audio_file = io.BytesIO(audio_data)
35
  # # Load the audio file using pydub
36
+ audio_array, sampling_rate = librosa.load(audio_file, sr=16000)
37
  # # Process the audio array
38
  # input_features = processor(audio_array, sampling_rate=sampling_rate, return_tensors="pt").input_features
39
  # # Generate token ids
40
  # predicted_ids = model.generate(input_features)
41
  # # Decode token ids to text
42
  # transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
43
+ transcription = pipe(audio_array,generate_kwargs = {"task":"transcribe", "language":"<|ar|>"})
44
  # Print the transcription
45
  print(transcription)
46
  print(transcription[0]) # Display the transcriptiontry: