Estwld commited on
Commit
ce67652
·
verified ·
1 Parent(s): 70ef47c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -16,7 +16,6 @@ def transcribe_audio(audio, api_key_state):
16
 
17
  client = openai.OpenAI(
18
  api_key=api_key_state,
19
- base_url=BASE_URL,
20
  )
21
  try:
22
  # 使用 OpenAI Whisper API 进行转录
@@ -41,14 +40,15 @@ with gr.Blocks(theme="default") as iface:
41
  gr.Markdown("🤟 使用 OpenAI Whisper API 将语音转录为文字")
42
 
43
  api_key_state = gr.State("")
44
-
45
- with gr.Row():
46
- audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath", label="录音或上传音频")
47
- api_key_input = gr.Textbox(type="password", label="API密钥", placeholder="请输入您的API密钥")
48
-
49
- transcribe_button = gr.Button("转录")
50
- clear_button = gr.ClearButton()
51
- output = gr.Textbox(label="转录文本", placeholder="转录的文字将显示在这里...", lines=10, interactive=True)
 
52
 
53
  # 设置 API 密钥的回调
54
  api_key_input.change(set_api_key, [api_key_input, api_key_state], [api_key_input, api_key_state])
 
16
 
17
  client = openai.OpenAI(
18
  api_key=api_key_state,
 
19
  )
20
  try:
21
  # 使用 OpenAI Whisper API 进行转录
 
40
  gr.Markdown("🤟 使用 OpenAI Whisper API 将语音转录为文字")
41
 
42
  api_key_state = gr.State("")
43
+
44
+ with gr.Col():
45
+ with gr.Row():
46
+ audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath", label="录音或上传音频")
47
+ api_key_input = gr.Textbox(type="password", label="API密钥", placeholder="请输入您的API密钥")
48
+
49
+ transcribe_button = gr.Button("转录")
50
+ clear_button = gr.ClearButton()
51
+ output = gr.Textbox(label="转录文本", placeholder="转录的文字将显示在这里...", lines=10, interactive=True)
52
 
53
  # 设置 API 密钥的回调
54
  api_key_input.change(set_api_key, [api_key_input, api_key_state], [api_key_input, api_key_state])