Skip to content

Commit

Permalink
interactive preview window
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasVincent committed Mar 9, 2023
1 parent 7a03d0b commit 00359ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions extensions/whisper_stt/script.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import gradio as gr
import speech_recognition as sr


input_hijack = {
'state': False,
'value': ["", ""]
}


def input_modifier(string):
return string


def do_stt():
transcription = ""
r = sr.Recognizer()
Expand All @@ -30,7 +25,13 @@ def do_stt():
return transcription


def update_hijack(val):
input_hijack.update({"state": True, "value": [val, val]})
return val


def ui():
speech_button = gr.Button(value="🎙️")
output_transcription = gr.Textbox(label="STT-Preview", placeholder="Speech Preview. Click \"Generate\" to send")
output_transcription = gr.Textbox(label="STT-Input", placeholder="Speech Preview. Click \"Generate\" to send", interactive=True)
output_transcription.change(fn=update_hijack, inputs=[output_transcription])
speech_button.click(do_stt, outputs=[output_transcription])

0 comments on commit 00359ba

Please sign in to comment.