mohan696matlab commited on
Commit
401279f
·
1 Parent(s): 65a7d00
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -59,9 +59,6 @@ def stream_transcribe(history, new_chunk, language_code, SARVAM_API_KEY):
59
 
60
  try:
61
  sr, y = new_chunk
62
-
63
- print(y.max(), y.min())
64
-
65
  # Convert to mono if stereo
66
  if y.ndim > 1:
67
  y = y.mean(axis=1)
@@ -79,7 +76,7 @@ def stream_transcribe(history, new_chunk, language_code, SARVAM_API_KEY):
79
 
80
  transcription,detected_language = translate_audio(audio_segment, language_code, SARVAM_API_KEY)
81
 
82
- history = history + '\n' + f'({detected_language})==> ' +transcription
83
 
84
  return history, history
85
  except ValueError as ve:
@@ -140,12 +137,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as microphone:
140
  with gr.Row():
141
  clear_button = gr.Button("Clear Output")
142
  clear_api_key_button = gr.Button("Clear API Key")
 
143
  state = gr.State(value="")
144
- def wrapped_stream_transcribe(history, new_chunk,language_code, api_key):
145
- return stream_transcribe(history, new_chunk,language_code, api_key)
146
 
147
  input_audio_microphone.stream(
148
- wrapped_stream_transcribe,
149
  [state, input_audio_microphone,language_code_box, api_key_box],
150
  [state, output],
151
  time_limit=30,
 
59
 
60
  try:
61
  sr, y = new_chunk
 
 
 
62
  # Convert to mono if stereo
63
  if y.ndim > 1:
64
  y = y.mean(axis=1)
 
76
 
77
  transcription,detected_language = translate_audio(audio_segment, language_code, SARVAM_API_KEY)
78
 
79
+ history = history + '\n' + f'({detected_language})==> ' + transcription
80
 
81
  return history, history
82
  except ValueError as ve:
 
137
  with gr.Row():
138
  clear_button = gr.Button("Clear Output")
139
  clear_api_key_button = gr.Button("Clear API Key")
140
+
141
  state = gr.State(value="")
 
 
142
 
143
  input_audio_microphone.stream(
144
+ stream_transcribe,
145
  [state, input_audio_microphone,language_code_box, api_key_box],
146
  [state, output],
147
  time_limit=30,