Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
@@ -8,19 +35,32 @@ with open("gpt4o_50.json", "r") as file:
|
|
8 |
|
9 |
st.title("JSON Data Visualization")
|
10 |
|
11 |
-
columns_per_row =
|
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 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
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 = 4
|
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 |
+
|
27 |
import streamlit as st
|
28 |
import json
|
29 |
|
30 |
+
# 加载数据
|
31 |
with open("qwen2vl_50.json", "r") as file:
|
32 |
qwen_data = json.load(file)
|
33 |
with open("gpt4o_50.json", "r") as file:
|
|
|
35 |
|
36 |
st.title("JSON Data Visualization")
|
37 |
|
38 |
+
columns_per_row = 4
|
39 |
columns = st.columns(columns_per_row)
|
40 |
|
41 |
+
# 用于存储每列的内容高度
|
42 |
+
heights = [0] * columns_per_row
|
43 |
+
content_list = [[] for _ in range(columns_per_row)] # 每列内容占位
|
44 |
+
|
45 |
+
# 遍历数据并将内容分配到列
|
46 |
for idx, (qwen, gpt) in enumerate(zip(qwen_data, gpt_data)):
|
47 |
image_name, image_url, description, qwen_category = qwen
|
48 |
_, _, _, gpt_category = gpt
|
49 |
|
50 |
+
# 将内容添加到对应列的内容列表中
|
51 |
+
col_idx = idx % columns_per_row
|
52 |
+
content = f"""
|
53 |
+
### {image_name}
|
54 |
+

|
55 |
+
**Description:** {description}
|
56 |
+
**Qwen_Category:** {qwen_category}
|
57 |
+
**GPT_Category:** {gpt_category}
|
58 |
+
---
|
59 |
+
"""
|
60 |
+
content_list[col_idx].append(content)
|
61 |
|
62 |
+
# 渲染每列内容
|
63 |
+
for col_idx, col_content in enumerate(content_list):
|
64 |
+
with columns[col_idx]:
|
65 |
+
for item in col_content:
|
66 |
+
st.markdown(item)
|