ysharma HF staff commited on
Commit
cd49d70
1 Parent(s): a18abb2
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -3,9 +3,6 @@ os.system("pip install git+https://github.com/openai/whisper.git")
3
  os.system("pip install neon-tts-plugin-coqui==0.6.0")
4
  import gradio as gr
5
  import whisper
6
-
7
- #import os
8
- #import gradio as gr
9
  import requests
10
  import tempfile
11
  from neon_tts_plugin_coqui import CoquiTTS
@@ -15,9 +12,7 @@ from datasets import load_dataset
15
  dataset = load_dataset("ysharma/short_jokes")
16
 
17
  # Language common in both the multilingual models - English, Chinese, Spanish, and French etc
18
- # So it would make sense to test the App on these four prominently
19
-
20
- # Whisper: Speech-to-text
21
  model = whisper.load_model("base")
22
  #model_med = whisper.load_model("medium")
23
  # Languages covered in Whisper - (exhaustive list) :
@@ -43,7 +38,7 @@ model = whisper.load_model("base")
43
  #"ln": "lingala", "ha": "hausa", "ba": "bashkir", "jw": "javanese", "su": "sundanese",
44
 
45
 
46
- # Text-to-Speech
47
  LANGUAGES = list(CoquiTTS.langs.keys())
48
  coquiTTS = CoquiTTS()
49
  print(f"Languages for Coqui are: {LANGUAGES}")
@@ -89,7 +84,7 @@ def whisper_stt(audio):
89
  #options_transc = whisper.DecodingOptions(fp16 = False, language=lang, task='transcribe') #lang
90
  options_transl = whisper.DecodingOptions(fp16 = False, language='en', task='translate') #lang
91
  #result_transc = whisper.decode(model_med, mel, options_transc)
92
- result_transl = whisper.decode(model_med, mel, options_transl)
93
 
94
  # print the recognized text
95
  #print(f"transcript is : {result_transc.text}")
 
3
  os.system("pip install neon-tts-plugin-coqui==0.6.0")
4
  import gradio as gr
5
  import whisper
 
 
 
6
  import requests
7
  import tempfile
8
  from neon_tts_plugin_coqui import CoquiTTS
 
12
  dataset = load_dataset("ysharma/short_jokes")
13
 
14
  # Language common in both the multilingual models - English, Chinese, Spanish, and French etc
15
+ # /model 1: Whisper: Speech-to-text
 
 
16
  model = whisper.load_model("base")
17
  #model_med = whisper.load_model("medium")
18
  # Languages covered in Whisper - (exhaustive list) :
 
38
  #"ln": "lingala", "ha": "hausa", "ba": "bashkir", "jw": "javanese", "su": "sundanese",
39
 
40
 
41
+ #Model 2: Text-to-Speech
42
  LANGUAGES = list(CoquiTTS.langs.keys())
43
  coquiTTS = CoquiTTS()
44
  print(f"Languages for Coqui are: {LANGUAGES}")
 
84
  #options_transc = whisper.DecodingOptions(fp16 = False, language=lang, task='transcribe') #lang
85
  options_transl = whisper.DecodingOptions(fp16 = False, language='en', task='translate') #lang
86
  #result_transc = whisper.decode(model_med, mel, options_transc)
87
+ result_transl = whisper.decode(model, mel, options_transl) #model_med
88
 
89
  # print the recognized text
90
  #print(f"transcript is : {result_transc.text}")