It seems there are some issues with using while loops in st.
I wanted a simple feature where when I wait for a reponse from API. display a spinner. But I cannot quite figure out how to wrap around it.
for example I might use
with container
response = call_steamship(prompt, context)
while not response:
container.spinner(waiting")
It seems the while part will never get executed. And also it seems that streamlit does not natively support async. Is there any way to achieve what I want?
with st.spinner("waiting"):
response = call_steamship(prompt, context)
If that doesn’t work for you for some reason, you’ll need to provide more context. If call_streamlit is async, then you need to await it, I guess. That is how you usually wait for async functions to provide a response.