Phoenix7 commited on
Commit
f92c539
1 Parent(s): c7ce74a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,19 +1,19 @@
1
  import gradio as gr
2
  import openai
3
- #from pathlib import Path
4
- # import os
5
 
6
  # openai.api_key = os.environ.get('OPEN_API_KEY')
7
- openai.api_key = "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"
8
 
9
 
10
  def transcribe(audio):
11
  print(audio)
12
 
13
- # myfile=Path(audio)
14
- # myfile=myfile.rename(myfile.with_suffix('.wav'))
15
 
16
- audio_file= open(audio, "rb")
17
 
18
  transcript = openai.Audio.transcribe("whisper-1", audio_file)
19
  print(transcript)
@@ -23,4 +23,4 @@ def transcribe(audio):
23
  demo = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
24
 
25
  demo.launch()
26
- #demo.launch(share=True)
 
1
  import gradio as gr
2
  import openai
3
+ from pathlib import Path
4
+ import os
5
 
6
  # openai.api_key = os.environ.get('OPEN_API_KEY')
7
+ openai.api_key = "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"
8
 
9
 
10
  def transcribe(audio):
11
  print(audio)
12
 
13
+ myfile=Path(audio)
14
+ myfile=myfile.rename(myfile.with_suffix('.wav'))
15
 
16
+ audio_file= open(myfile, "rb")
17
 
18
  transcript = openai.Audio.transcribe("whisper-1", audio_file)
19
  print(transcript)
 
23
  demo = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
24
 
25
  demo.launch()
26
+ #demo.launch(share=True)