File size: 583 Bytes
e95972f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
import json

# 加载 JSON 数据
with open("data.json", "r") as file:
    data = json.load(file)

# Streamlit 应用
st.title("JSON Data Visualization")

# 遍历数据并显示内容
for entry in data:
    # 解构数据
    image_name, image_url, description, category = entry

    # 显示图像
    st.subheader(f"{image_name} - {category}")
    st.image(image_url, caption=description, use_column_width=True)

    # 显示文本信息
    st.markdown(f"**Description:** {description}")
    st.markdown(f"**Category:** {category}")
    st.markdown("---")