tyang4 commited on
Commit
a2a5666
·
verified ·
1 Parent(s): e3d04cf

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +38 -14
src/streamlit_app.py CHANGED
@@ -853,24 +853,48 @@ if st.session_state.ready_to_continue:
853
  # df = standardize_latlon(entry["df"])
854
  # st.dataframe(df.head(50))
855
  # st.write(entry.get("summary", ""))
856
- else: # ★
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
857
  if idx < len(st.session_state.all_dataframes):
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
-
863
- # 添加下载按钮
864
- tmp_path = f"/tmp/subtask_{idx+1}_display.csv"
865
- df.to_csv(tmp_path, index=False)
866
- with open(tmp_path, "rb") as f:
867
- st.download_button(
868
- label="📥 Download dataset (CSV)",
869
- data=f,
870
- file_name=os.path.basename(tmp_path),
871
- mime="text/csv",
872
- key=f"download_rerun_{idx}"
873
- )
 
 
 
 
 
874
 
875
  # 检索完成后打标记
876
  if not st.session_state.retrieval_done: # ★
 
853
  # df = standardize_latlon(entry["df"])
854
  # st.dataframe(df.head(50))
855
  # st.write(entry.get("summary", ""))
856
+ # else: # ★
857
+ # if idx < len(st.session_state.all_dataframes):
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
+
863
+ # # 添加下载按钮
864
+ # tmp_path = f"/tmp/subtask_{idx+1}_display.csv"
865
+ # df.to_csv(tmp_path, index=False)
866
+ # with open(tmp_path, "rb") as f:
867
+ # st.download_button(
868
+ # label="📥 Download dataset (CSV)",
869
+ # data=f,
870
+ # file_name=os.path.basename(tmp_path),
871
+ # mime="text/csv",
872
+ # key=f"download_rerun_{idx}"
873
+ # )
874
+
875
+ else:
876
  if idx < len(st.session_state.all_dataframes):
877
  entry = st.session_state.all_dataframes[idx]
878
  df = standardize_latlon(entry["df"])
879
  st.dataframe(df.head(50))
880
+
881
+ if not st.session_state.do_visualize: # ✅ 防止重复展示 summary 和按钮
882
+ st.markdown("**📝 Dataset Introduction:**")
883
+ st.write(entry.get("summary", ""))
884
+
885
+ # 添加下载按钮
886
+ tmp_path = f"/tmp/subtask_{idx+1}_display.csv"
887
+ df.to_csv(tmp_path, index=False)
888
+ with open(tmp_path, "rb") as f:
889
+ st.download_button(
890
+ label="📥 Download dataset (CSV)",
891
+ data=f,
892
+ file_name=os.path.basename(tmp_path),
893
+ mime="text/csv",
894
+ key=f"download_rerun_{idx}"
895
+ )
896
+
897
+
898
 
899
  # 检索完成后打标记
900
  if not st.session_state.retrieval_done: # ★