linbojunzi commited on
Commit
2d356c4
·
verified ·
1 Parent(s): cb3e90d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -1,26 +1,26 @@
1
  import streamlit as st
2
  import json
3
 
 
4
  with open("qwen2vl_50.json", "r") as file:
5
  qwen_data = json.load(file)
6
  with open("gpt4o_50.json", "r") as file:
7
  gpt_data = json.load(file)
8
 
 
9
  st.title("JSON Data Visualization")
10
 
11
- columns_per_row = 2
12
- columns = st.columns(columns_per_row)
13
-
14
- for idx, (qwen, gpt) in enumerate(zip(qwen_data, gpt_data)):
15
  image_name, image_url, description, qwen_category = qwen
16
  _, _, _, gpt_category = gpt
 
 
 
17
 
18
- col = columns[idx % columns_per_row] # 按列循环分配
19
- with col:
20
- st.subheader(f"{image_name}")
21
- st.image(image_url, caption=description, use_column_width=True)
22
- st.markdown(f"**Description:** {description}")
23
- st.markdown(f"**Qwen_Category:** {qwen_category}")
24
- st.markdown(f"**GPT_Category:** {gpt_category}")
25
- st.markdown("---")
26
-
 
1
  import streamlit as st
2
  import json
3
 
4
+ # 加载 JSON 数据
5
  with open("qwen2vl_50.json", "r") as file:
6
  qwen_data = json.load(file)
7
  with open("gpt4o_50.json", "r") as file:
8
  gpt_data = json.load(file)
9
 
10
+ # Streamlit 应用
11
  st.title("JSON Data Visualization")
12
 
13
+ # 遍历数据并显示内容
14
+ for qwen,gpt in zip(qwen_data,gpt_data):
15
+ # 解构数据
 
16
  image_name, image_url, description, qwen_category = qwen
17
  _, _, _, gpt_category = gpt
18
+ # 显示图像
19
+ st.subheader(f"{image_name}")
20
+ st.image(image_url, caption=description, use_column_width=True)
21
 
22
+ # 显示文本信息
23
+ st.markdown(f"**Description:** {description}")
24
+ st.markdown(f"**Qwen_Category:** {qwen_category}")
25
+ st.markdown(f"**GPT_Category:** {gpt_category}")
26
+ st.markdown("---")