cotxetj commited on
Commit
6eaf87c
1 Parent(s): d65e856

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -5,7 +5,6 @@ from transformers import pipeline, VitsModel, VitsTokenizer, SpeechT5ForTextToSp
5
  import numpy as np
6
  os.system("pip install git+https://github.com/openai/whisper.git")
7
  import gradio as gr
8
- import whisper
9
  import requests
10
 
11
  MODEL = "gpt-3.5-turbo"
@@ -13,7 +12,6 @@ API_URL = os.getenv("API_URL")
13
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
14
  NUM_THREADS = 2
15
 
16
- model = whisper.load_model("small")
17
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
18
 
19
 
@@ -32,12 +30,7 @@ def parse_codeblock(text):
32
 
33
 
34
 
35
- #Load Whisper-small
36
- pipe = pipeline("automatic-speech-recognition",
37
- model="openai/whisper-small",
38
- device=device
39
- )
40
- #pipe = pipeline(model="Sleepyp00/whisper-small-Swedish")
41
 
42
  model2 = VitsModel.from_pretrained("facebook/mms-tts-eng")
43
  tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
@@ -174,10 +167,10 @@ description="Use Whisper pretrained model to convert swedish audio to english (t
174
  supportLangs = ["Swedish", "French (in training)"]
175
  transTypes = ["Text", "Audio", "GPT answer"]
176
 
177
- #examples = [
178
- # ["Text", "Swedish", "./ex1.wav", None],
179
- # ["Audio", "Swedish", "./ex2.wav", None]
180
- #]
181
 
182
  examples =[]
183
  demo = gr.Interface(
 
5
  import numpy as np
6
  os.system("pip install git+https://github.com/openai/whisper.git")
7
  import gradio as gr
 
8
  import requests
9
 
10
  MODEL = "gpt-3.5-turbo"
 
12
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
13
  NUM_THREADS = 2
14
 
 
15
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
16
 
17
 
 
30
 
31
 
32
 
33
+ pipe = pipeline(model="Sleepyp00/whisper-small-Swedish")
 
 
 
 
 
34
 
35
  model2 = VitsModel.from_pretrained("facebook/mms-tts-eng")
36
  tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
 
167
  supportLangs = ["Swedish", "French (in training)"]
168
  transTypes = ["Text", "Audio", "GPT answer"]
169
 
170
+ examples = [
171
+ ["Text", "Swedish", "./ex1.wav", None],
172
+ ["Audio", "Swedish", "./ex2.wav", None]
173
+ ]
174
 
175
  examples =[]
176
  demo = gr.Interface(