Button to start speech recognition works the first time pressed only

I am using streamlit to run a speech recognition task. I created a button that launches the SR script. The first time, it works fine, the speech is recognized and transcribed correctly on the platform.
But when I press the button a second time, the app hangs, streamlit show the message “Running …”

This is the streamlit part:

if st.button("Click-me to speak"):
        text= get_audio()
        query = st.text_input("Input your prompt here: ", text, key="transcription")
        if query:
            submit = True
            result = chain({"input_documents": docs, "human_input": 
            query}, return_only_outputs=True)
            st.write(result['output_text'])

get_audio() is calling the speech_recognition script that does the recognition.
My app runs locally.
Streamlit version 1.32.1
Python version 3.11

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.