mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
interactive preview window
This commit is contained in:
parent
7a03d0bda3
commit
00359ba054
@ -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()
|
||||
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user