Gradio message limit

Hello there! Suppose I have a chat UI created with gradio. Is there a way I can limit the users’ messages they can send to the model(3 per minute for example)?

@abidlabs Can you help?

Hi @nbaru, Gradio doesn’t do any sort of rate limiting, but you could get the IP address from the raw request (gr.Request object) and then apply some rate limiting in your function itself. See here: Gradio Request Docs

@abidlabs Thank you,one more question if you do not mind. What is the equivalent of
‘st.session_state’ of streamlit in gradio?