Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,15 +22,13 @@ folders = {
|
|
22 |
def read_csv_from_github(file_path):
|
23 |
response = requests.get(f"{base_url}/{file_path}")
|
24 |
if response.status_code == 200:
|
25 |
-
return pd.read_csv(response.text)
|
26 |
else:
|
27 |
return None
|
28 |
|
29 |
# Main Streamlit app
|
30 |
def main():
|
31 |
st.title("Hadith Viewer")
|
32 |
-
st.image("https://github.com/halimbahae/Hadith/blob/main/Hadith_Books.jpg", caption="Hadith Books", use_column_width=True)
|
33 |
-
|
34 |
st.sidebar.title("Books")
|
35 |
selected_folder = st.sidebar.selectbox("Select a Book", list(folders.values()))
|
36 |
|
@@ -38,12 +36,17 @@ def main():
|
|
38 |
file_name = f"{selected_folder.lower()}_{'' if mufassala else 'not_'}mufassala.utf8.csv"
|
39 |
csv_df = read_csv_from_github(f"{selected_folder}/{file_name}")
|
40 |
|
|
|
|
|
|
|
41 |
if csv_df is not None:
|
42 |
-
st.sidebar.subheader("Description")
|
43 |
-
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 'Mufassala' version or not.")
|
44 |
st.dataframe(csv_df)
|
45 |
else:
|
46 |
st.error("Error loading CSV file")
|
47 |
|
|
|
|
|
|
|
|
|
48 |
if __name__ == "__main__":
|
49 |
main()
|
|
|
22 |
def read_csv_from_github(file_path):
|
23 |
response = requests.get(f"{base_url}/{file_path}")
|
24 |
if response.status_code == 200:
|
25 |
+
return pd.read_csv(response.text, encoding='utf-8')
|
26 |
else:
|
27 |
return None
|
28 |
|
29 |
# Main Streamlit app
|
30 |
def main():
|
31 |
st.title("Hadith Viewer")
|
|
|
|
|
32 |
st.sidebar.title("Books")
|
33 |
selected_folder = st.sidebar.selectbox("Select a Book", list(folders.values()))
|
34 |
|
|
|
36 |
file_name = f"{selected_folder.lower()}_{'' if mufassala else 'not_'}mufassala.utf8.csv"
|
37 |
csv_df = read_csv_from_github(f"{selected_folder}/{file_name}")
|
38 |
|
39 |
+
st.sidebar.subheader("Description")
|
40 |
+
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 'Mufassala' version or not.")
|
41 |
+
|
42 |
if csv_df is not None:
|
|
|
|
|
43 |
st.dataframe(csv_df)
|
44 |
else:
|
45 |
st.error("Error loading CSV file")
|
46 |
|
47 |
+
# Display image
|
48 |
+
image_url = "https://raw.githubusercontent.com/halimbahae/Hadith/main/Hadith_Books.jpg"
|
49 |
+
st.image(image_url, caption="Hadith Books", use_column_width=True)
|
50 |
+
|
51 |
if __name__ == "__main__":
|
52 |
main()
|