EloiCampeny commited on
Commit
8765be8
1 Parent(s): 65d91d0

trying to resolve the bug

Browse files

Change the form to create trans model

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