Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,6 @@
|
|
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,49 +8,19 @@ with open("gpt4o_50.json", "r") as file:
|
|
35 |
|
36 |
st.title("JSON Data Visualization")
|
37 |
|
38 |
-
|
39 |
-
st.
|
40 |
-
<style>
|
41 |
-
.row {
|
42 |
-
display: flex;
|
43 |
-
flex-wrap: wrap;
|
44 |
-
justify-content: space-between;
|
45 |
-
}
|
46 |
-
.column {
|
47 |
-
flex: 1 1 calc(25% - 20px); /* 固定为 4 列,每列占 25% 减去间距 */
|
48 |
-
max-width: calc(25% - 20px);
|
49 |
-
margin: 10px;
|
50 |
-
box-sizing: border-box;
|
51 |
-
}
|
52 |
-
.content {
|
53 |
-
height: 100%;
|
54 |
-
display: flex;
|
55 |
-
flex-direction: column;
|
56 |
-
justify-content: space-between;
|
57 |
-
background-color: #f9f9f9;
|
58 |
-
padding: 10px;
|
59 |
-
border: 1px solid #ddd;
|
60 |
-
border-radius: 5px;
|
61 |
-
}
|
62 |
-
</style>
|
63 |
-
""", unsafe_allow_html=True)
|
64 |
|
65 |
-
|
66 |
-
st.markdown('<div class="row">', unsafe_allow_html=True)
|
67 |
-
for qwen, gpt in zip(qwen_data, gpt_data):
|
68 |
image_name, image_url, description, qwen_category = qwen
|
69 |
_, _, _, gpt_category = gpt
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
</div>
|
81 |
-
"""
|
82 |
-
st.markdown(content, unsafe_allow_html=True)
|
83 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
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 |
+
|
|
|
|
|
|
|
|