awacke1 commited on
Commit
423f589
·
1 Parent(s): ea4879e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -26
app.py CHANGED
@@ -5,7 +5,6 @@ from st_aggrid.grid_options_builder import GridOptionsBuilder
5
  from st_aggrid.shared import JsCode
6
  from download import download_button
7
  from st_aggrid import GridUpdateMode, DataReturnMode
8
-
9
  def _max_width_():
10
  max_width_str = f"max-width: 1800px;"
11
  st.markdown(
@@ -18,46 +17,31 @@ def _max_width_():
18
  """,
19
  unsafe_allow_html=True,
20
  )
21
-
22
- st.set_page_config(page_icon="🧠", page_title="CSV Dataset Analyzer")
23
-
24
  col1, col2, col3 = st.columns([1,6,1])
25
  with col1:
26
- st.image("https://cdna.artstation.com/p/assets/images/images/054/900/924/large/aaron-wacker-event-horizon.jpg?1665626929",width=100,)
27
  with col2:
28
- st.title("CSV Dataset Analyzer")
29
  with col3:
30
- st.write("")
31
  c29, c30, c31 = st.columns([1, 6, 1])
32
  with c30:
33
- uploaded_file = st.file_uploader(
34
- "",
35
- key="1",
36
- help="To activate 'wide mode', go to the hamburger menu > Settings > turn on 'wide mode'",
37
- )
38
  if uploaded_file is not None:
39
  file_container = st.expander("Check your uploaded .csv")
40
  shows = pd.read_csv(uploaded_file)
41
  uploaded_file.seek(0)
42
  file_container.write(shows)
43
  else:
44
- st.info(
45
- f"""
46
- 👆 Upload a .csv file first. Sample to try: [biostats.csv](https://people.sc.fsu.edu/~jburkardt/data/csv/biostats.csv)
47
- """
48
- )
49
  st.stop()
50
-
51
  gb = GridOptionsBuilder.from_dataframe(shows)
52
  gb.configure_default_column(enablePivot=True, enableValue=True, enableRowGroup=True)
53
  gb.configure_selection(selection_mode="multiple", use_checkbox=True)
54
  gb.configure_side_bar() # side_bar is clearly a typo :) should by sidebar
55
  gridOptions = gb.build()
56
- st.success(
57
- f"""
58
- 💡 Tip! Hold the shift key when selecting rows to select multiple rows at once!
59
- """
60
- )
61
  response = AgGrid(
62
  shows,
63
  gridOptions=gridOptions,
@@ -67,7 +51,7 @@ response = AgGrid(
67
  fit_columns_on_grid_load=False,
68
  )
69
  df = pd.DataFrame(response["selected_rows"])
70
- st.subheader("Filtered data will appear below 👇 ")
71
  st.text("")
72
  st.table(df)
73
  st.text("")
@@ -76,11 +60,11 @@ with c29:
76
  CSVButton = download_button(
77
  df,
78
  "File.csv",
79
- "Download to CSV",
80
  )
81
  with c30:
82
  CSVButton = download_button(
83
  df,
84
  "File.csv",
85
- "Download to TXT",
86
  )
 
5
  from st_aggrid.shared import JsCode
6
  from download import download_button
7
  from st_aggrid import GridUpdateMode, DataReturnMode
 
8
  def _max_width_():
9
  max_width_str = f"max-width: 1800px;"
10
  st.markdown(
 
17
  """,
18
  unsafe_allow_html=True,
19
  )
20
+ st.set_page_config(page_icon="📝", page_title="CSV Dataset Analyzer")
 
 
21
  col1, col2, col3 = st.columns([1,6,1])
22
  with col1:
23
+ st.image("https://cdna.artstation.com/p/assets/images/images/054/900/924/large/aaron-wacker-event-horizon.jpg?1665626929",width=100,)
24
  with col2:
25
+ st.title("📝🧠CSV Dataset Analyzer🧠📝")
26
  with col3:
27
+ st.write("")
28
  c29, c30, c31 = st.columns([1, 6, 1])
29
  with c30:
30
+ uploaded_file = st.file_uploader("", key="1", help="To activate 'wide mode', go to the menu > Settings > turn on 'wide mode'",)
 
 
 
 
31
  if uploaded_file is not None:
32
  file_container = st.expander("Check your uploaded .csv")
33
  shows = pd.read_csv(uploaded_file)
34
  uploaded_file.seek(0)
35
  file_container.write(shows)
36
  else:
37
+ st.info(f"""⬆️Upload⬆️ a 📝.CSV📝 file. AI Generated Dataset Examples: [Carddata.csv](https://huggingface.co/datasets/awacke1/Carddata.csv) [MindfulStory.csv](https://huggingface.co/datasets/awacke1/MindfulStory.csv) [WikipediaSearch](https://huggingface.co/datasets/awacke1/WikipediaSearch)""")
 
 
 
 
38
  st.stop()
 
39
  gb = GridOptionsBuilder.from_dataframe(shows)
40
  gb.configure_default_column(enablePivot=True, enableValue=True, enableRowGroup=True)
41
  gb.configure_selection(selection_mode="multiple", use_checkbox=True)
42
  gb.configure_side_bar() # side_bar is clearly a typo :) should by sidebar
43
  gridOptions = gb.build()
44
+ st.success(f"""💡 Tip! Hold shift key when selecting rows to select multiple rows at once.""")
 
 
 
 
45
  response = AgGrid(
46
  shows,
47
  gridOptions=gridOptions,
 
51
  fit_columns_on_grid_load=False,
52
  )
53
  df = pd.DataFrame(response["selected_rows"])
54
+ st.subheader("Filtered data will appear below 📊 ")
55
  st.text("")
56
  st.table(df)
57
  st.text("")
 
60
  CSVButton = download_button(
61
  df,
62
  "File.csv",
63
+ "Download CSV file",
64
  )
65
  with c30:
66
  CSVButton = download_button(
67
  df,
68
  "File.csv",
69
+ "Download TXT file",
70
  )