KleinPenny commited on
Commit
9338b19
·
verified ·
1 Parent(s): a51ca36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -63,6 +63,17 @@ input_audio = gr.Audio(
63
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
64
  """
65
 
 
 
 
 
 
 
 
 
 
 
 
66
  # 创建 Gradio 接口
67
  def create_interface():
68
  with gr.Blocks() as demo:
@@ -89,7 +100,7 @@ def create_interface():
89
  process_button = gr.Button("处理音频")
90
 
91
  # 绑定处理逻辑
92
- process_button.click(process_audio, inputs=[audio_input], outputs=[recognized_text, audio_output])
93
 
94
  return demo
95
 
 
63
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
64
  """
65
 
66
+ # 定义音频处理函数
67
+ def process_audio(audio):
68
+ if audio is None:
69
+ return "No audio provided", None
70
+
71
+ # 将音频保存为 .wav 格式
72
+ audio_path = "uploaded_audio.wav"
73
+ audio.save(audio_path)
74
+
75
+ return “True”
76
+
77
  # 创建 Gradio 接口
78
  def create_interface():
79
  with gr.Blocks() as demo:
 
100
  process_button = gr.Button("处理音频")
101
 
102
  # 绑定处理逻辑
103
+ process_button.click(process_audio, inputs=[audio_input], outputs=[words])
104
 
105
  return demo
106