shourya-goenka commited on
Commit
7422180
·
verified ·
1 Parent(s): 9993720

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import torch
2
  from transformers import pipeline
3
  import json
 
 
4
 
5
  transcribe = pipeline(task = "automatic-speech-recognition", model = "vasista22/whisper-tamil-medium", chunk_length_s=30, device="cpu")
6
  transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ta", task="transcribe")
@@ -31,6 +33,8 @@ def process_audio(params):
31
 
32
  # text = response['results']['channels'][0]['alternatives'][0]['transcript']
33
  print(audio)
 
 
34
  text = transcribe(audio)["text"]
35
 
36
  answer_dict = {}
 
1
  import torch
2
  from transformers import pipeline
3
  import json
4
+ import requests
5
+ from io import BytesIO
6
 
7
  transcribe = pipeline(task = "automatic-speech-recognition", model = "vasista22/whisper-tamil-medium", chunk_length_s=30, device="cpu")
8
  transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ta", task="transcribe")
 
33
 
34
  # text = response['results']['channels'][0]['alternatives'][0]['transcript']
35
  print(audio)
36
+ response = requests.get(audio_url)
37
+ audio = BytesIO(response.content)
38
  text = transcribe(audio)["text"]
39
 
40
  answer_dict = {}