wang0507 commited on
Commit
ff66686
·
1 Parent(s): 2c7f128

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,7 +1,13 @@
 
 
1
  import gradio as gr
2
  import whisper
 
 
 
 
 
3
 
4
- model = whisper.load_model("large")
5
 
6
 
7
  def inference(audio):
@@ -12,13 +18,11 @@ def inference(audio):
12
 
13
  _, probs = model.detect_language(mel)
14
 
15
- options = whisper.DecodingOptions(fp16=False)
16
  result = whisper.decode(model, mel, options)
17
 
18
  print(result.text)
19
-
20
- return result.text
21
-
22
 
23
  iface = gr.Interface(
24
  fn=inference,
@@ -26,10 +30,5 @@ iface = gr.Interface(
26
  outputs="text"
27
  )
28
 
29
- # 启动 Gradio 界面并获取永久链接
30
- share_link = iface.share()
31
-
32
- # 打印永久链接
33
- print(f"Gradio Interface URL: {share_link}")
34
-
35
-
 
1
+ import os
2
+ os.system("pip install git+https://github.com/openai/whisper.git")
3
  import gradio as gr
4
  import whisper
5
+ import soundfile as sf
6
+
7
+
8
+
9
+ model = whisper.load_model("base")
10
 
 
11
 
12
 
13
  def inference(audio):
 
18
 
19
  _, probs = model.detect_language(mel)
20
 
21
+ options = whisper.DecodingOptions(fp16 = False)
22
  result = whisper.decode(model, mel, options)
23
 
24
  print(result.text)
25
+ return result.text, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
 
 
26
 
27
  iface = gr.Interface(
28
  fn=inference,
 
30
  outputs="text"
31
  )
32
 
33
+ # 启动 Gradio 界面
34
+ iface.launch()