Spaces:
Sleeping
Sleeping
wcy
commited on
Commit
·
aa0485a
1
Parent(s):
d59db74
first
Browse files- 2-chart_res.json +0 -0
- app.py +46 -0
- requirements.txt +3 -0
2-chart_res.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# 显示单个字典的信息
|
| 7 |
+
def display_dict(data):
|
| 8 |
+
st.write("### 文件信息")
|
| 9 |
+
st.write(f"**Path:** {data['paper_id']}")
|
| 10 |
+
st.write(f"**Image ID:** {data['image_id']}")
|
| 11 |
+
url = 'https://arxiv.org/pdf/'+data['paper_id'][0:10]+'.pdf'
|
| 12 |
+
st.markdown(f"**🔗 URL:** [View Paper]({url})")
|
| 13 |
+
|
| 14 |
+
st.write("### Descriptive Questions & Answers")
|
| 15 |
+
st.markdown(f"**Q1:** {data['Descriptive_question1']}")
|
| 16 |
+
st.markdown(f"**A1:** {data['Descriptive_answer1']}")
|
| 17 |
+
st.markdown(f"**Q2:** {data['Descriptive_question2']}")
|
| 18 |
+
st.markdown(f"**A2:** {data['Descriptive_answer2']}")
|
| 19 |
+
|
| 20 |
+
st.write("### Reasoning Questions & Answers")
|
| 21 |
+
st.markdown(f"**Q1:** {data['Reasoning_question1']}")
|
| 22 |
+
st.markdown(f"**A1:** {data['Reasoning_answer1']}")
|
| 23 |
+
st.markdown(f"**Q2:** {data['Reasoning_question2']}")
|
| 24 |
+
st.markdown(f"**A2:** {data['Reasoning_answer2']}")
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# 主程序
|
| 28 |
+
def main():
|
| 29 |
+
st.title("Example For Chart")
|
| 30 |
+
|
| 31 |
+
with open('2-chart_res.json', "r", encoding="utf-8") as f:
|
| 32 |
+
data = json.load(f)
|
| 33 |
+
file_dict = {}
|
| 34 |
+
for idx,item in enumerate(data):
|
| 35 |
+
file_dict[item['paper_id'][0:10]+'_'+item['table_id']] = idx
|
| 36 |
+
file_list = list(file_dict.keys())
|
| 37 |
+
# 搜索框选择文件
|
| 38 |
+
selected_file = st.selectbox("选择一个文件", file_list)
|
| 39 |
+
|
| 40 |
+
# 加载并展示JSON内容
|
| 41 |
+
if selected_file:
|
| 42 |
+
st.write(f"当前选择文件: **{selected_file}**")
|
| 43 |
+
display_dict(data[file_dict[selected_file]])
|
| 44 |
+
|
| 45 |
+
if __name__ == "__main__":
|
| 46 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
numpy
|