binqiangliu commited on
Commit
dec61a0
·
1 Parent(s): e422617

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -73,6 +73,11 @@ def transcribe(audio):
73
  # Gradio output
74
 
75
  bot = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="audio")
 
 
 
 
 
76
  bot.launch(share=False)
77
 
78
  iface.share()
 
73
  # Gradio output
74
 
75
  bot = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="audio")
76
+ #这里,inputs中的filepath,表示的是,通过麦克风录音后直接存储在运行程序的设备本地
77
+ #例如:C:\Users\lenovo\AppData\Local\Temp\gradio\eec7427c8cf8fe8058c18255820b4e9e0260ca5d\audio-0-100.wav
78
+ #这个被存储的语音文件随后可以作为其他函数或功能模块的输入,例如Whisper用于将该语音转文本时候的audio_file = open(audio, "rb"),其中的audio就是这个audio-0-100.wav
79
+ #audio_file则是一个(临时)变量,被用作transcribe的参数:transcript = openai.Audio.transcribe("whisper-1", audio_file)
80
+
81
  bot.launch(share=False)
82
 
83
  iface.share()