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 1
1
import gradio as gr
2
2
import speech_recognition as sr
3
3
4
-
5
4
input_hijack = {
6
5
'state' : False ,
7
6
'value' : ["" , "" ]
8
7
}
9
8
10
9
11
- def input_modifier (string ):
12
- return string
13
-
14
-
15
10
def do_stt ():
16
11
transcription = ""
17
12
r = sr .Recognizer ()
@@ -30,7 +25,13 @@ def do_stt():
30
25
return transcription
31
26
32
27
28
+ def update_hijack (val ):
29
+ input_hijack .update ({"state" : True , "value" : [val , val ]})
30
+ return val
31
+
32
+
33
33
def ui ():
34
34
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 ])
36
37
speech_button .click (do_stt , outputs = [output_transcription ])
You can’t perform that action at this time.
0 commit comments