File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 11import gradio as gr
22import speech_recognition as sr
33
4-
54input_hijack = {
65 'state' : False ,
76 'value' : ["" , "" ]
87}
98
109
11- def input_modifier (string ):
12- return string
13-
14-
1510def do_stt ():
1611 transcription = ""
1712 r = sr .Recognizer ()
@@ -30,7 +25,13 @@ def do_stt():
3025 return transcription
3126
3227
28+ def update_hijack (val ):
29+ input_hijack .update ({"state" : True , "value" : [val , val ]})
30+ return val
31+
32+
3333def ui ():
3434 speech_button = gr .Button (value = "🎙️" )
35- output_transcription = gr .Textbox (label = "STT-Preview" , placeholder = "Speech Preview. Click \" Generate\" to send" )
35+ output_transcription = gr .Textbox (label = "STT-Input" , placeholder = "Speech Preview. Click \" Generate\" to send" , interactive = True )
36+ output_transcription .change (fn = update_hijack , inputs = [output_transcription ])
3637 speech_button .click (do_stt , outputs = [output_transcription ])
You can’t perform that action at this time.
0 commit comments