Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,9 +53,9 @@ cmap = plt.colormaps['cool']
|
|
| 53 |
|
| 54 |
books = load_dataset('FDSRashid/Hadith_info', data_files='Books.csv', token = Secret_token)['train'].to_pandas()
|
| 55 |
|
| 56 |
-
matn_info['
|
| 57 |
matn_info['Hadith Number'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[1]))
|
| 58 |
-
|
| 59 |
|
| 60 |
def value_to_hex(value):
|
| 61 |
rgba_color = cmap(value)
|
|
@@ -121,10 +121,10 @@ def visualize_isnad(taraf_num, yaxis):
|
|
| 121 |
|
| 122 |
def taraf_booknum(taraf_num):
|
| 123 |
taraf = matn_info[matn_info['taraf_ID'] == taraf_num]
|
| 124 |
-
return taraf[['matn', '
|
| 125 |
|
| 126 |
def visualize_subTaraf(df, yaxis):
|
| 127 |
-
df['bookid_hadithid'] = df['
|
| 128 |
hadith = matn_info[matn_info['bookid_hadithid'].isin(df['bookid_hadithid'])]
|
| 129 |
taraf_hadith_split = [i.split('_') for i in hadith['bookid_hadithid'].to_list()]
|
| 130 |
hadith_cleaned = isnad_info['Hadiths Cleaned'].apply(lambda x: any(i in x for i in taraf_hadith_split))
|
|
@@ -176,7 +176,7 @@ with gr.Blocks() as demo:
|
|
| 176 |
with gr.Tab('Select Hadith Isnad Visualizer'):
|
| 177 |
yyaxis = gr.Dropdown(choices = ['Taraf', 'Hadith', 'Isnad', 'Book'], value = 'Taraf', label = 'Variable to Display', info = 'Choose the variable to visualize.')
|
| 178 |
hadith_selection = gr.Dataframe(
|
| 179 |
-
headers=["
|
| 180 |
datatype=["number", "number"],
|
| 181 |
row_count=5,
|
| 182 |
col_count=(2, "fixed"))
|
|
|
|
| 53 |
|
| 54 |
books = load_dataset('FDSRashid/Hadith_info', data_files='Books.csv', token = Secret_token)['train'].to_pandas()
|
| 55 |
|
| 56 |
+
matn_info['Book_ID'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[0]))
|
| 57 |
matn_info['Hadith Number'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[1]))
|
| 58 |
+
pd.merge(matn_info, books, on='Book_ID')
|
| 59 |
|
| 60 |
def value_to_hex(value):
|
| 61 |
rgba_color = cmap(value)
|
|
|
|
| 121 |
|
| 122 |
def taraf_booknum(taraf_num):
|
| 123 |
taraf = matn_info[matn_info['taraf_ID'] == taraf_num]
|
| 124 |
+
return taraf[['matn', 'Book_ID', 'Hadith Number', 'Book_Name', 'Author']]
|
| 125 |
|
| 126 |
def visualize_subTaraf(df, yaxis):
|
| 127 |
+
df['bookid_hadithid'] = df['Book_ID'].astype(str) + '_' + df['Hadith Number'].astype(str)
|
| 128 |
hadith = matn_info[matn_info['bookid_hadithid'].isin(df['bookid_hadithid'])]
|
| 129 |
taraf_hadith_split = [i.split('_') for i in hadith['bookid_hadithid'].to_list()]
|
| 130 |
hadith_cleaned = isnad_info['Hadiths Cleaned'].apply(lambda x: any(i in x for i in taraf_hadith_split))
|
|
|
|
| 176 |
with gr.Tab('Select Hadith Isnad Visualizer'):
|
| 177 |
yyaxis = gr.Dropdown(choices = ['Taraf', 'Hadith', 'Isnad', 'Book'], value = 'Taraf', label = 'Variable to Display', info = 'Choose the variable to visualize.')
|
| 178 |
hadith_selection = gr.Dataframe(
|
| 179 |
+
headers=["Book_ID", "Hadith Number"],
|
| 180 |
datatype=["number", "number"],
|
| 181 |
row_count=5,
|
| 182 |
col_count=(2, "fixed"))
|