Truong-Phuc Nguyen commited on
Commit
080d2e8
·
verified ·
1 Parent(s): b610e6b

Add Download button

Browse files
Files changed (1) hide show
  1. app.py +1 -10
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import pandas as pd
2
  import streamlit as st
3
  import re
4
- import os
5
 
6
  st.set_page_config(page_icon='🍃', page_title='MRC for Legal Document Dataset checker', layout='wide', initial_sidebar_state="collapsed")
7
 
@@ -14,14 +13,6 @@ if 'idx' not in st.session_state:
14
 
15
  st.markdown(f"<h4 style='text-align: center;'>Sample {st.session_state.idx + 1}/{len(df)}</h4>", unsafe_allow_html=True)
16
 
17
- root_folder = './'
18
-
19
- # Lấy danh sách các thư mục và tập tin trong thư mục gốc
20
- contents = os.listdir(root_folder)
21
-
22
- # Hiển thị tiêu đề
23
- st.title("Danh sách thư mục và tập tin trong thư mục gốc")
24
-
25
  col_1, col_2, col_3, col_4, col_5, col_6, col_7, col_8, col_9, col_10 = st.columns([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
26
 
27
  btn_previous = col_1.button(label=':arrow_backward: Previous sample', use_container_width=True)
@@ -55,5 +46,5 @@ if len(df) != 0:
55
  df['context'][st.session_state.idx] = txt_context
56
  df['question'][st.session_state.idx] = txt_question
57
  df['answer'][st.session_state.idx] = txt_answer
58
-
59
  df.to_csv(path_or_buf='./Legal_AbstractiveA.csv', index=None)
 
1
  import pandas as pd
2
  import streamlit as st
3
  import re
 
4
 
5
  st.set_page_config(page_icon='🍃', page_title='MRC for Legal Document Dataset checker', layout='wide', initial_sidebar_state="collapsed")
6
 
 
13
 
14
  st.markdown(f"<h4 style='text-align: center;'>Sample {st.session_state.idx + 1}/{len(df)}</h4>", unsafe_allow_html=True)
15
 
 
 
 
 
 
 
 
 
16
  col_1, col_2, col_3, col_4, col_5, col_6, col_7, col_8, col_9, col_10 = st.columns([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
17
 
18
  btn_previous = col_1.button(label=':arrow_backward: Previous sample', use_container_width=True)
 
46
  df['context'][st.session_state.idx] = txt_context
47
  df['question'][st.session_state.idx] = txt_question
48
  df['answer'][st.session_state.idx] = txt_answer
49
+ btn_download = col_4.download_button(data=df, label=':arrow_down_small: Download file', use_container_width=True, file_name="checked.csv", mime="text/csv")
50
  df.to_csv(path_or_buf='./Legal_AbstractiveA.csv', index=None)