Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import requests
|
| 4 |
-
from io import StringIO
|
| 5 |
|
| 6 |
# Define the base URL for the raw GitHub content
|
| 7 |
base_url = "https://raw.githubusercontent.com/halimbahae/Hadith/main"
|
|
@@ -23,7 +22,7 @@ folders = {
|
|
| 23 |
def read_csv_from_github(file_path):
|
| 24 |
response = requests.get(f"{base_url}/{file_path}")
|
| 25 |
if response.status_code == 200:
|
| 26 |
-
return pd.read_csv(
|
| 27 |
else:
|
| 28 |
return None
|
| 29 |
|
|
@@ -36,7 +35,7 @@ def main():
|
|
| 36 |
selected_folder = st.sidebar.selectbox("Select a Book", list(folders.values()))
|
| 37 |
|
| 38 |
mufassala = st.sidebar.checkbox("Mufassala")
|
| 39 |
-
file_name = f"{selected_folder.
|
| 40 |
csv_df = read_csv_from_github(f"{selected_folder}/{file_name}")
|
| 41 |
|
| 42 |
if csv_df is not None:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import requests
|
|
|
|
| 4 |
|
| 5 |
# Define the base URL for the raw GitHub content
|
| 6 |
base_url = "https://raw.githubusercontent.com/halimbahae/Hadith/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)
|
| 26 |
else:
|
| 27 |
return None
|
| 28 |
|
|
|
|
| 35 |
selected_folder = st.sidebar.selectbox("Select a Book", list(folders.values()))
|
| 36 |
|
| 37 |
mufassala = st.sidebar.checkbox("Mufassala")
|
| 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:
|