Kleber commited on
Commit
a719fc8
1 Parent(s): bd275e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -8,12 +8,14 @@ df = pd.read_csv("amasaku_data.tsv",sep='\t')
8
 
9
  amasaku_mapping = {str(key).lower():str(val).lower() for key,val in zip(df.iloc[:,0],df.iloc[:,1])}
10
 
11
- def transcribe(file):
12
 
13
  #if not audio:
14
  # return {state_var: state, transcription_var: state}
15
 
16
  #print("filename: ",file)
 
 
17
  try:
18
  audio = AudioSegment.from_file(file)
19
  if audio.frame_rate != 16000:
@@ -38,6 +40,7 @@ with gr.Blocks() as demo:
38
 
39
  with gr.Row():
40
  with gr.Column():
 
41
  uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath")
42
 
43
  with gr.Column():
@@ -47,7 +50,7 @@ with gr.Blocks() as demo:
47
 
48
  transcribe_button.click(
49
  transcribe,
50
- [uploaded_audio],
51
  transcription
52
  )
53
 
 
8
 
9
  amasaku_mapping = {str(key).lower():str(val).lower() for key,val in zip(df.iloc[:,0],df.iloc[:,1])}
10
 
11
+ def transcribe(microphone,file):
12
 
13
  #if not audio:
14
  # return {state_var: state, transcription_var: state}
15
 
16
  #print("filename: ",file)
17
+ if microphone:
18
+ file = microphone
19
  try:
20
  audio = AudioSegment.from_file(file)
21
  if audio.frame_rate != 16000:
 
40
 
41
  with gr.Row():
42
  with gr.Column():
43
+ microphone = gr.Audio(source="microphone", type="filepath", label="Microphone")
44
  uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath")
45
 
46
  with gr.Column():
 
50
 
51
  transcribe_button.click(
52
  transcribe,
53
+ [microphone, uploaded_audio],
54
  transcription
55
  )
56