xiaopch commited on
Commit
c0de0e5
·
1 Parent(s): 2646b41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -1,27 +1,27 @@
1
  import os
2
- os.system("pip install git+https://github.com/openai/whisper.git")
3
  import gradio as gr
4
- import whisper
5
 
6
- from share_btn import community_icon_html, loading_icon_html, share_js
7
 
8
- model = whisper.load_model("small")
9
 
10
 
11
 
12
  def inference(audio):
13
- audio = whisper.load_audio(audio)
14
- audio = whisper.pad_or_trim(audio)
15
 
16
- mel = whisper.log_mel_spectrogram(audio).to(model.device)
17
 
18
- _, probs = model.detect_language(mel)
19
 
20
- options = whisper.DecodingOptions(fp16 = False)
21
- result = whisper.decode(model, mel, options)
22
 
23
- print(result.text)
24
- return result.text, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
25
 
26
 
27
 
 
1
  import os
2
+ # os.system("pip install git+https://github.com/openai/whisper.git")
3
  import gradio as gr
4
+ # import whisper
5
 
6
+ # from share_btn import community_icon_html, loading_icon_html, share_js
7
 
8
+ # model = whisper.load_model("small")
9
 
10
 
11
 
12
  def inference(audio):
13
+ # audio = whisper.load_audio(audio)
14
+ # audio = whisper.pad_or_trim(audio)
15
 
16
+ # mel = whisper.log_mel_spectrogram(audio).to(model.device)
17
 
18
+ # _, probs = model.detect_language(mel)
19
 
20
+ # options = whisper.DecodingOptions(fp16 = False)
21
+ # result = whisper.decode(model, mel, options)
22
 
23
+ # print(result.text)
24
+ return 'test', gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
25
 
26
 
27