Pijush2023 commited on
Commit
622ab15
·
verified ·
1 Parent(s): c82efd7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -1343,9 +1343,7 @@ def transcribe_function_whisper(audio):
1343
  full_text = result.get("text", "")
1344
  return full_text
1345
 
1346
- # Add a clear function to reset the stream state and chat input
1347
- def clear_stream_transcription():
1348
- return None, ""
1349
 
1350
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1351
  with gr.Row():
@@ -1362,9 +1360,7 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1362
  tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta", "Gamma"], value="Alpha")
1363
  retriever_button = gr.Button("Retriever")
1364
 
1365
- # Add the clear button and bind it to the clear function
1366
- clear_btn = gr.Button("Clear Stream Transcription")
1367
- clear_btn.click(clear_stream_transcription, outputs=[stream_transcription, chat_input])
1368
 
1369
  gr.Markdown("<h1 style='color: red;'>Radar Map</h1>", elem_id="Map-Radar")
1370
  location_output = gr.HTML()
@@ -1393,7 +1389,8 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1393
  stream_audio_input = gr.Audio(sources=["microphone"], type='numpy', streaming=True)
1394
  stream_transcription = gr.State(None) # Initialize stream state
1395
  stream_audio_input.change(transcribe_function, inputs=[stream_transcription, stream_audio_input], outputs=[stream_transcription, chat_input])
1396
-
 
1397
 
1398
 
1399
 
 
1343
  full_text = result.get("text", "")
1344
  return full_text
1345
 
1346
+
 
 
1347
 
1348
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1349
  with gr.Row():
 
1360
  tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta", "Gamma"], value="Alpha")
1361
  retriever_button = gr.Button("Retriever")
1362
 
1363
+
 
 
1364
 
1365
  gr.Markdown("<h1 style='color: red;'>Radar Map</h1>", elem_id="Map-Radar")
1366
  location_output = gr.HTML()
 
1389
  stream_audio_input = gr.Audio(sources=["microphone"], type='numpy', streaming=True)
1390
  stream_transcription = gr.State(None) # Initialize stream state
1391
  stream_audio_input.change(transcribe_function, inputs=[stream_transcription, stream_audio_input], outputs=[stream_transcription, chat_input])
1392
+
1393
+ clear_btn.click(lambda: [None, 0], outputs=[None, 0])
1394
 
1395
 
1396