Spaces:
Sleeping
Sleeping
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("---") | |