Spaces:
Running
Running
linbojunzi
commited on
Commit
•
ce41bcb
1
Parent(s):
f61b805
Update app.py
Browse files
app.py
CHANGED
@@ -11,14 +11,52 @@ def load_json(file_name):
|
|
11 |
with open(file_path, "r", encoding="utf-8") as f:
|
12 |
return json.load(f)
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# 显示单个字典的信息
|
15 |
def display_dict(data):
|
16 |
st.write("### 文件信息")
|
17 |
st.write(f"**Path:** {data['path']}")
|
18 |
st.write(f"**Table ID:** {data['table_id']}")
|
19 |
st.write(f"**Section:** {data['section']}")
|
|
|
20 |
st.write("### Table")
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
st.write("### Context")
|
23 |
# 拼接 all_context 并高亮 target_context_ids 的句子
|
24 |
all_context = data["all_context"]
|
|
|
11 |
with open(file_path, "r", encoding="utf-8") as f:
|
12 |
return json.load(f)
|
13 |
|
14 |
+
# # 显示单个字典的信息
|
15 |
+
# def display_dict(data):
|
16 |
+
# st.write("### 文件信息")
|
17 |
+
# st.write(f"**Path:** {data['path']}")
|
18 |
+
# st.write(f"**Table ID:** {data['table_id']}")
|
19 |
+
# st.write(f"**Section:** {data['section']}")
|
20 |
+
# st.write("### Table")
|
21 |
+
# st.markdown(data['table_html'], unsafe_allow_html=True)
|
22 |
+
# st.write("### Context")
|
23 |
+
# # 拼接 all_context 并高亮 target_context_ids 的句子
|
24 |
+
# all_context = data["all_context"]
|
25 |
+
# highlighted_context = ""
|
26 |
+
# for idx, sentence in enumerate(all_context):
|
27 |
+
# if idx == data["perturb_sentence_id"]:
|
28 |
+
# highlighted_context += f"<span style='color:red;'>{sentence}</span> "
|
29 |
+
# elif idx in data["target_context_ids"]:
|
30 |
+
# highlighted_context += f"**{sentence}** "
|
31 |
+
# else:
|
32 |
+
# highlighted_context += sentence + " "
|
33 |
+
# st.markdown(highlighted_context, unsafe_allow_html=True)
|
34 |
+
|
35 |
+
# st.write("### Selected Paragraphs")
|
36 |
+
# for paragraph in data["selected_paragraphs"]:
|
37 |
+
# st.write(paragraph)
|
38 |
+
|
39 |
+
# st.write("### Output")
|
40 |
+
# st.write("**Perturbed Statement:**")
|
41 |
+
# st.write(data["output"]["perturbed_statement"])
|
42 |
+
# st.write("**Perturbed Explanation:**")
|
43 |
+
# st.write(data["output"]["perturbed_explanation"])
|
44 |
# 显示单个字典的信息
|
45 |
def display_dict(data):
|
46 |
st.write("### 文件信息")
|
47 |
st.write(f"**Path:** {data['path']}")
|
48 |
st.write(f"**Table ID:** {data['table_id']}")
|
49 |
st.write(f"**Section:** {data['section']}")
|
50 |
+
|
51 |
st.write("### Table")
|
52 |
+
# 添加滚动容器
|
53 |
+
table_container = f"""
|
54 |
+
<div style="max-height: 400px; overflow-y: auto; border: 1px solid #ddd; padding: 10px;">
|
55 |
+
{data['table_html']}
|
56 |
+
</div>
|
57 |
+
"""
|
58 |
+
st.markdown(table_container, unsafe_allow_html=True)
|
59 |
+
|
60 |
st.write("### Context")
|
61 |
# 拼接 all_context 并高亮 target_context_ids 的句子
|
62 |
all_context = data["all_context"]
|