import streamlit as st
import psutil
import time
def main():
st.title("树莓派状态看板")
container = st.empty()
while True:
cpu_percent = psutil.cpu_percent()
mem = psutil.virtual_memory()
disk = psutil.disk_usage('/')
container.write(f"CPU使用率: {cpu_percent}%")
container.write(f"内存使用情况: {mem.percent}%")
container.write(f"磁盘使用情况: {disk.percent}%")
time.sleep(5)
if __name__ == '__main__':
main()