Untitled

 avatar
unknown
plain_text
a year ago
673 B
4
Indexable
import streamlit as st
from streamlit.hashing import _CodeHasher

# Decorator tùy chỉnh để vô hiệu hóa thông báo
def hide_cache_output(func):
    def wrapper(*args, **kwargs):
        # Tạo một mã băm tạm thời để vô hiệu hóa thông báo
        hasher = _CodeHasher()
        with st.cache(hash_funcs={type(hasher): lambda _: None}):
            return func(*args, **kwargs)
    return wrapper

# Hàm được bảo cache và không hiển thị thông báo
@hide_cache_output
@st.cache(allow_output_mutation=True)
def my_cached_function():
    # Đoạn code của bạn ở đây
    pass

# Sử dụng hàm bảo cache
my_cached_function()
Editor is loading...