pragsGit commited on
Commit
965c1d5
1 Parent(s): 2d6a6f9

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -18,11 +18,11 @@ def translate(audio):
18
  outputs = pipe(
19
  audio,
20
  max_new_tokens=256,
21
- generate_kwargs={"task": "transcribe", "language": "de"}
22
  )
23
 
24
- model = VitsModel.from_pretrained("facebook/mms-tts-deu")
25
- tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-deu")
26
 
27
  def synthesise(text):
28
  inputs=tokenizer(text, return_tensors="pt")
@@ -41,17 +41,17 @@ demo = gr.Blocks()
41
 
42
  mic_translate = gr.Interface(
43
  fn=speech_to_speech_translation,
44
- inputs=gr.Audio(sources="microphone", type="filepath"),
45
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
46
  )
47
 
48
  file_translate = gr.Interface(
49
  fn=speech_to_speech_translation,
50
- inputs=gr.Audio(sources="upload", type="filepath"),
51
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
52
  )
53
 
54
  with demo:
55
  gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
56
 
57
- demo.launch(share=True)
 
18
  outputs = pipe(
19
  audio,
20
  max_new_tokens=256,
21
+ generate_kwargs={"task": "transcribe", "language": "es"}
22
  )
23
 
24
+ model = VitsModel.from_pretrained("facebook/mms-tts-spa")
25
+ tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-spa")
26
 
27
  def synthesise(text):
28
  inputs=tokenizer(text, return_tensors="pt")
 
41
 
42
  mic_translate = gr.Interface(
43
  fn=speech_to_speech_translation,
44
+ inputs=gr.Audio(source="microphone", type="filepath"),
45
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
46
  )
47
 
48
  file_translate = gr.Interface(
49
  fn=speech_to_speech_translation,
50
+ inputs=gr.Audio(source="upload", type="filepath"),
51
  outputs=gr.Audio(label="Generated Speech", type="numpy"),
52
  )
53
 
54
  with demo:
55
  gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
56
 
57
+ demo.launch(debug=True)