Making markdowns disappear automatically

hey guys, im running my app locally, im trying to display responses from model immediately and then make them disappear from streamlit app automatically after all models are displayed," the displayed responses should disappear after all models are done" , i have tried everything but for some reason its not working, i would appreciate ur help

        for task in asyncio.as_completed(tasks):
            model, response, latency = await task

            if isinstance(response, dict):
                model_responses[model] = response['choices'][0]["message"]["content"].strip()
                model_responses[model] = response

            model_latencies[model] = latency

            response_container_index = selected_models.index(model)
            with response_containers[response_container_index]:
                st.markdown(f"**Response from {model}:** {model_responses[model]}")
                st.markdown(f"**Latency for {model}:** {latency:.3f} seconds")
                st.markdown("<hr>", unsafe_allow_html=True)

        # Display a button to clear responses
        if not all_responses_displayed:
            if st.button("Clear Responses", key="clear_button"):  # Add a key to the button
                st.session_state.model_responses = {}
                st.session_state.model_latencies = {}
                all_responses_displayed = True

        if all_responses_displayed:

    return model_responses, model_latencies

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