halimbahae commited on
Commit
44cddda
·
verified ·
1 Parent(s): 8441f78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -70,14 +70,29 @@ def display_home():
70
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
71
  st.write("Welcome to the Hadith Viewer! This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left to view its contents.")
72
 
 
 
 
 
 
 
 
 
 
73
  def display_table(csv_df):
74
  font_size = st.slider("Adjust Font Size", min_value=10, max_value=30, value=20)
75
  st.write("### Table View")
76
  search_query = st.sidebar.text_input("Search", "")
77
  filtered_df = csv_df[csv_df.apply(lambda row: row.astype(str).str.contains(search_query, case=False).any(), axis=1)]
78
- styled_df = filtered_df.style.set_properties(**{'font-size': f'{font_size}px'})
79
- styled_df = styled_df.set_table_styles([{'selector': 'tr', 'props': [('line-height', '30px')]}])
 
 
 
 
80
  st.dataframe(styled_df)
81
 
 
 
82
  if __name__ == "__main__":
83
  main()
 
70
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
71
  st.write("Welcome to the Hadith Viewer! This is a viewer for the Hadith collections. You can select a book from the dropdown menu on the left to view its contents.")
72
 
73
+ # def display_table(csv_df):
74
+ # font_size = st.slider("Adjust Font Size", min_value=10, max_value=30, value=20)
75
+ # st.write("### Table View")
76
+ # search_query = st.sidebar.text_input("Search", "")
77
+ # filtered_df = csv_df[csv_df.apply(lambda row: row.astype(str).str.contains(search_query, case=False).any(), axis=1)]
78
+ # styled_df = filtered_df.style.set_properties(**{'font-size': f'{font_size}px'})
79
+ # styled_df = styled_df.set_table_styles([{'selector': 'tr', 'props': [('line-height', '30px')]}])
80
+ # st.dataframe(styled_df)
81
+
82
  def display_table(csv_df):
83
  font_size = st.slider("Adjust Font Size", min_value=10, max_value=30, value=20)
84
  st.write("### Table View")
85
  search_query = st.sidebar.text_input("Search", "")
86
  filtered_df = csv_df[csv_df.apply(lambda row: row.astype(str).str.contains(search_query, case=False).any(), axis=1)]
87
+ styled_df = (
88
+ filtered_df.style
89
+ .set_properties(**{'font-size': f'{font_size}px'})
90
+ .set_table_styles([{'selector': 'th', 'props': [('font-size', f'{font_size}px')]},
91
+ {'selector': 'td', 'props': [('font-size', f'{font_size}px'), ('line-height', '1.5')]}])
92
+ )
93
  st.dataframe(styled_df)
94
 
95
+
96
+
97
  if __name__ == "__main__":
98
  main()