Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ Secret_token = os.getenv('HF_token')
|
|
16 |
dataset = load_dataset("FDSRashid/embed_matn", token = Secret_token)
|
17 |
books = load_dataset('FDSRashid/Hadith_info', data_files='Books.csv', token=Secret_token)['train'].to_pandas()
|
18 |
df = dataset["train"].to_pandas()
|
19 |
-
|
20 |
|
21 |
dataset = load_dataset("FDSRashid/hadith_info", data_files = 'All_Matns.csv',token = Secret_token, features = features)
|
22 |
matn_info = dataset['train'].to_pandas()
|
@@ -27,10 +27,11 @@ matn_info['taraf_ID'] = matn_info['taraf_ID'].replace('KeyAbsent', -1)
|
|
27 |
matn_info['Book ID'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[0]))
|
28 |
matn_info['Hadith Number'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[1]))
|
29 |
matn_info = matn_info.join(books, on='Book ID')
|
|
|
30 |
|
31 |
-
joined_df = matn_info.merge(df, left_index=True, right_on='__index_level_0__')
|
32 |
df = joined_df.copy()
|
33 |
-
|
34 |
|
35 |
def plot_similarity_score(taraf_num):
|
36 |
taraf_df = df[df['taraf_ID']== taraf_num]
|
|
|
16 |
dataset = load_dataset("FDSRashid/embed_matn", token = Secret_token)
|
17 |
books = load_dataset('FDSRashid/Hadith_info', data_files='Books.csv', token=Secret_token)['train'].to_pandas()
|
18 |
df = dataset["train"].to_pandas()
|
19 |
+
|
20 |
|
21 |
dataset = load_dataset("FDSRashid/hadith_info", data_files = 'All_Matns.csv',token = Secret_token, features = features)
|
22 |
matn_info = dataset['train'].to_pandas()
|
|
|
27 |
matn_info['Book ID'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[0]))
|
28 |
matn_info['Hadith Number'] = matn_info['bookid_hadithid'].apply(lambda x: int(x.split('_')[1]))
|
29 |
matn_info = matn_info.join(books, on='Book ID')
|
30 |
+
cols_to_use = df.columns.difference(matn_info.columns)
|
31 |
|
32 |
+
joined_df = matn_info.merge(df[cols_to_use, left_index=True, right_on='__index_level_0__')
|
33 |
df = joined_df.copy()
|
34 |
+
taraf_max = np.max(df['taraf_ID'].unique())
|
35 |
|
36 |
def plot_similarity_score(taraf_num):
|
37 |
taraf_df = df[df['taraf_ID']== taraf_num]
|