EloiCampeny commited on
Commit
c2b5789
1 Parent(s): 0f4430e

trying to solve the model import

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1,8 +1,14 @@
1
  import gradio as gr
2
- from transformers import pipeline
 
 
 
 
 
 
 
 
3
 
4
- # audio2text
5
- trans = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish")
6
 
7
  def audio2text(audio):
8
  text = trans(audio)["text"]
 
1
  import gradio as gr
2
+ from transformers import pipeline, AutoModelForCTC, AutoTokenizer
3
+
4
+ # Load the model from PyTorch weights
5
+ model_name = "facebook/wav2vec2-large-xlsr-53-spanish"
6
+ model = AutoModelForCTC.from_pretrained(model_name, from_pt=True)
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
8
+
9
+ # Create the ASR pipeline
10
+ trans = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer)
11
 
 
 
12
 
13
  def audio2text(audio):
14
  text = trans(audio)["text"]