Update src/streamlit_app.py
Browse files- src/streamlit_app.py +47 -6
src/streamlit_app.py
CHANGED
|
@@ -821,24 +821,65 @@ if st.session_state.ready_to_continue:
|
|
| 821 |
"summary": summary
|
| 822 |
})
|
| 823 |
st.dataframe(df.head(50))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
save_path = save_dataset(df, f"subtask_{idx+1}")
|
| 825 |
if save_path:
|
| 826 |
-
# summary = evaluate_dataset_with_gpt(subtask, df)
|
| 827 |
st.markdown("**📝 Dataset Introduction:**")
|
| 828 |
st.write(summary)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 829 |
if 'progress_bar' in locals():
|
| 830 |
progress_bar.progress((idx + 1) / total)
|
| 831 |
|
| 832 |
# ---------- 之后 rerun:只展示 ----------
|
| 833 |
-
else: # ★
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 834 |
if idx < len(st.session_state.all_dataframes):
|
| 835 |
-
|
| 836 |
-
# df = standardize_latlon(df)
|
| 837 |
-
# st.dataframe(df.head(50))
|
| 838 |
-
entry = st.session_state.all_dataframes[idx] # ➕ 新行
|
| 839 |
df = standardize_latlon(entry["df"])
|
|
|
|
|
|
|
| 840 |
st.dataframe(df.head(50))
|
|
|
|
|
|
|
| 841 |
st.write(entry.get("summary", ""))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
|
| 843 |
# 检索完成后打标记
|
| 844 |
if not st.session_state.retrieval_done: # ★
|
|
|
|
| 821 |
"summary": summary
|
| 822 |
})
|
| 823 |
st.dataframe(df.head(50))
|
| 824 |
+
# save_path = save_dataset(df, f"subtask_{idx+1}")
|
| 825 |
+
# if save_path:
|
| 826 |
+
# # summary = evaluate_dataset_with_gpt(subtask, df)
|
| 827 |
+
# st.markdown("**📝 Dataset Introduction:**")
|
| 828 |
+
# st.write(summary)
|
| 829 |
+
st.dataframe(df.head(50))
|
| 830 |
save_path = save_dataset(df, f"subtask_{idx+1}")
|
| 831 |
if save_path:
|
|
|
|
| 832 |
st.markdown("**📝 Dataset Introduction:**")
|
| 833 |
st.write(summary)
|
| 834 |
+
# 添加下载按钮
|
| 835 |
+
with open(save_path, "rb") as f:
|
| 836 |
+
st.download_button(
|
| 837 |
+
label="📥 Download full dataset (CSV)",
|
| 838 |
+
data=f,
|
| 839 |
+
file_name=os.path.basename(save_path),
|
| 840 |
+
mime="text/csv"
|
| 841 |
+
)
|
| 842 |
+
with open(save_path, "rb") as f:
|
| 843 |
+
st.download_button(
|
| 844 |
+
label="📥 Download full dataset (CSV)",
|
| 845 |
+
data=f,
|
| 846 |
+
file_name=os.path.basename(save_path),
|
| 847 |
+
mime="text/csv"
|
| 848 |
+
)
|
| 849 |
if 'progress_bar' in locals():
|
| 850 |
progress_bar.progress((idx + 1) / total)
|
| 851 |
|
| 852 |
# ---------- 之后 rerun:只展示 ----------
|
| 853 |
+
# else: # ★
|
| 854 |
+
# if idx < len(st.session_state.all_dataframes):
|
| 855 |
+
# # _hash, df = st.session_state.all_dataframes[idx]
|
| 856 |
+
# # df = standardize_latlon(df)
|
| 857 |
+
# # st.dataframe(df.head(50))
|
| 858 |
+
# entry = st.session_state.all_dataframes[idx] # ➕ 新行
|
| 859 |
+
# df = standardize_latlon(entry["df"])
|
| 860 |
+
# st.dataframe(df.head(50))
|
| 861 |
+
# st.write(entry.get("summary", ""))
|
| 862 |
+
else: # ★
|
| 863 |
if idx < len(st.session_state.all_dataframes):
|
| 864 |
+
entry = st.session_state.all_dataframes[idx]
|
|
|
|
|
|
|
|
|
|
| 865 |
df = standardize_latlon(entry["df"])
|
| 866 |
+
|
| 867 |
+
# 显示前 50 行数据
|
| 868 |
st.dataframe(df.head(50))
|
| 869 |
+
|
| 870 |
+
# 显示数据简介
|
| 871 |
st.write(entry.get("summary", ""))
|
| 872 |
+
|
| 873 |
+
# 保存并添加下载按钮
|
| 874 |
+
save_path = save_dataset(df, f"subtask_{idx+1}")
|
| 875 |
+
if save_path:
|
| 876 |
+
with open(save_path, "rb") as f:
|
| 877 |
+
st.download_button(
|
| 878 |
+
label="📥 Download full dataset (CSV)",
|
| 879 |
+
data=f,
|
| 880 |
+
file_name=os.path.basename(save_path),
|
| 881 |
+
mime="text/csv"
|
| 882 |
+
)
|
| 883 |
|
| 884 |
# 检索完成后打标记
|
| 885 |
if not st.session_state.retrieval_done: # ★
|