Simulate a key enter i.e return in a textbox

Hi Gradio experts,
I have simple example of a chatbot that can accept text input but also using audio(source=microphone). I have managed that after the recording the textbox of the user message is filled with the transcribe text. If enter manually a return then its ok. But it would be more user friendly if the audio is transcibted into the textbox it automatically submit i.e simulatie a key stroke with a ENTER/Return. I did try using a change event on the textbox and as a function print(chr(13)) but that does not work(no effect)

Thanks in advance.

mycode is:

def enterReturn():
return chr(13)

def clear_audio():
return None

def voice_to_text(voice_file, language=‘nl’):
audio_file= open(voice_file, “rb”)
with open(voice_file, “rb”) as audio_file:
transcript = openai.Audio.transcribe(
file = audio_file,
model = “whisper-1”,
return transcript

block = gr.Blocks(theme=gr.themes.Default(,

with block:

test speech to text

chatbot = gr.Chatbot()
lang_choices = gr.Dropdown([‘nl’, ‘de’, ‘en’,‘fr’,‘id’,‘bn’,‘hi’,‘it’],interactive=True, value=‘nl’, label=‘Languages’)
with gr.Row():
msg = gr.Textbox(label=‘Question’,interactive=True)
with gr.Row():
audio_src.stop_recording(fn = voice_to_text,
inputs = [audio_src,lang_choices],
outputs = [msg])
btn= gr.Button(“clear”) :None, None, audio_src)
with gr.Row():
clear = gr.Button(‘Clear’)
def user(user_message, history):
print(history + [[user_message, None]])
return “”, history + [[user_message, None]]

def bot(message,history):
    print('message','history: ',message, history)
    response = message[len(message)-1][0] #history[len(history)-1][0]
    bot_message = response 
    message[-1][1] = ""
    for character in bot_message:
        message[-1][1] += character
        yield message
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False, show_progress=True).then(
    bot, [chatbot,lang_choices], chatbot
) None, None, chatbot, queue=False)

block.queue().launch(debug = True,share=False)