Jiangxz commited on
Commit
073e826
·
verified ·
1 Parent(s): c6c7e29

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -44,6 +44,7 @@ def validate_and_convert(file, Language, api_key):
44
  if api_key == os.getenv("SPACE_ID"):
45
  api_key = os.getenv("YOUR_API_KEY")
46
  except Exception as e:
 
47
  gr.Warning("請輸入正確的 API Key!!")
48
  return None, None, f"請輸入正確的 API Key!!", None, None
49
  gr.Info("檔案上傳完成,開始轉換......")
@@ -293,8 +294,8 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as demo:
293
  )
294
  transcription_text = gr.Markdown(label="語音轉譯結果", elem_classes="text-background")
295
  file_input.upload(
296
- fn=validate_and_convert,
297
- inputs=[file_input, Language, api_key_input],
298
  outputs=[file_input, output_audio, output_text, transcription_text, srt_file_output]
299
  )
300
  clear_button.click(
 
44
  if api_key == os.getenv("SPACE_ID"):
45
  api_key = os.getenv("YOUR_API_KEY")
46
  except Exception as e:
47
+ os.remove(file.name)
48
  gr.Warning("請輸入正確的 API Key!!")
49
  return None, None, f"請輸入正確的 API Key!!", None, None
50
  gr.Info("檔案上傳完成,開始轉換......")
 
294
  )
295
  transcription_text = gr.Markdown(label="語音轉譯結果", elem_classes="text-background")
296
  file_input.upload(
297
+ fn=validate_and_convert,
298
+ inputs=[file_input, Language, api_key_input],
299
  outputs=[file_input, output_audio, output_text, transcription_text, srt_file_output]
300
  )
301
  clear_button.click(