halimbahae commited on
Commit
8146db1
·
verified ·
1 Parent(s): 06489f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -9
app.py CHANGED
@@ -54,9 +54,37 @@ def main():
54
  st.sidebar.subheader("Description")
55
  st.sidebar.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Display image on HOME click
58
  if st.sidebar.button("HOME"):
59
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
 
60
 
61
  # Load CSV file immediately when selected from the list
62
  file_url = f"https://raw.githubusercontent.com/halimbahae/Hadith/main/{selected_book}/{selected_file}"
@@ -65,15 +93,6 @@ def main():
65
  if csv_df is not None:
66
  # Display dataframe with search, filters, and pagination
67
  st.dataframe(csv_df)
68
- # Show rows per page selector
69
- rows_per_page = st.number_input("Rows per Page", min_value=1, value=10)
70
- # Show page number selector
71
- page_number = st.number_input("Page Number", min_value=1, value=1)
72
- # Slice dataframe based on page number and rows per page
73
- start_idx = (page_number - 1) * rows_per_page
74
- end_idx = start_idx + rows_per_page
75
- paginated_df = csv_df.iloc[start_idx:end_idx]
76
- st.write(paginated_df)
77
  else:
78
  st.error("Error loading CSV file")
79
 
 
54
  st.sidebar.subheader("Description")
55
  st.sidebar.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
56
 
57
+ # Dark/Light mode button
58
+ theme = st.sidebar.radio("Choose Theme", ("Dark", "Light"))
59
+ if theme == "Dark":
60
+ st.markdown(
61
+ """
62
+ <style>
63
+ .css-17eq0hr {
64
+ color: white;
65
+ background-color: #1e1e1e;
66
+ }
67
+ </style>
68
+ """,
69
+ unsafe_allow_html=True,
70
+ )
71
+ else:
72
+ st.markdown(
73
+ """
74
+ <style>
75
+ .css-17eq0hr {
76
+ color: black;
77
+ background-color: #f4f4f4;
78
+ }
79
+ </style>
80
+ """,
81
+ unsafe_allow_html=True,
82
+ )
83
+
84
  # Display image on HOME click
85
  if st.sidebar.button("HOME"):
86
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
87
+ st.write("This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left, and choose whether you want to view the 'Detailler' version or not.")
88
 
89
  # Load CSV file immediately when selected from the list
90
  file_url = f"https://raw.githubusercontent.com/halimbahae/Hadith/main/{selected_book}/{selected_file}"
 
93
  if csv_df is not None:
94
  # Display dataframe with search, filters, and pagination
95
  st.dataframe(csv_df)
 
 
 
 
 
 
 
 
 
96
  else:
97
  st.error("Error loading CSV file")
98