halimbahae commited on
Commit
9e2e456
·
verified ·
1 Parent(s): d8ae2ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -44,15 +44,15 @@ book_files = {
44
 
45
  # Main Streamlit app
46
  def main():
47
- st.sidebar.title("Navigation")
48
- st.sidebar.subheader("Search")
49
- search_query = st.sidebar.text_input("Search")
 
50
 
 
51
  st.sidebar.subheader("Actions")
52
  if st.sidebar.button("Home"):
53
  display_home()
54
- if st.sidebar.button("Global Search"):
55
- global_search(search_query)
56
 
57
  st.sidebar.title("Books")
58
  selected_book = st.sidebar.selectbox("Select a Book", list(book_files.keys()))
@@ -66,18 +66,16 @@ def main():
66
 
67
  if csv_df is not None:
68
  # Display dataframe with search, filters, and pagination
69
- st.dataframe(csv_df)
70
- else:
71
- st.error("Error loading CSV file")
 
 
72
 
73
  def display_home():
74
  st.title("Hadith Viewer")
75
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
76
- 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.")
77
-
78
- def global_search(query):
79
- st.write(f"Performing global search for: {query}")
80
- # Add your global search logic here
81
 
82
  if __name__ == "__main__":
83
  main()
 
44
 
45
  # Main Streamlit app
46
  def main():
47
+ st.title("Hadith Viewer")
48
+
49
+ # Display home content by default
50
+ display_home()
51
 
52
+ st.sidebar.title("Navigation")
53
  st.sidebar.subheader("Actions")
54
  if st.sidebar.button("Home"):
55
  display_home()
 
 
56
 
57
  st.sidebar.title("Books")
58
  selected_book = st.sidebar.selectbox("Select a Book", list(book_files.keys()))
 
66
 
67
  if csv_df is not None:
68
  # Display dataframe with search, filters, and pagination
69
+ if "_mushakkala_mufassala" in selected_file:
70
+ csv_df.columns = ["ID", "Hadith", "Explanation"]
71
+ else:
72
+ csv_df.columns = ["ID", "Hadith"]
73
+ st.table(csv_df.style.set_table_styles([dict(selector="th",props=[('max-width', '30px')])]))
74
 
75
  def display_home():
76
  st.title("Hadith Viewer")
77
  st.image("https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
78
+ 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.")
 
 
 
 
79
 
80
  if __name__ == "__main__":
81
  main()