Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,12 @@ import os
|
|
5 |
import pandas as pd
|
6 |
from datasets import load_dataset
|
7 |
from sklearn.metrics.pairwise import cosine_similarity
|
8 |
-
|
9 |
import plotly.express as px
|
|
|
|
|
|
|
|
|
10 |
Secret_token = os.getenv('HF_token')
|
11 |
|
12 |
dataset = load_dataset("FDSRashid/embed_matn", token = Secret_token)
|
@@ -40,7 +44,7 @@ def plot_similarity_score(taraf_num):
|
|
40 |
lower_triangle = matr[mask]
|
41 |
data = lower_triangle.flatten()
|
42 |
fig_dis = px.histogram(x = data, title = f'Similarity Distribution for Taraf {taraf_num}', labels = {'x': 'Similarity Score'}, nbins = 20, template = 'ggplot2' )
|
43 |
-
return fig, fig_dis, taraf_df[['matn', 'Number', '
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
taraf_number = gr.Slider(1,taraf_max , value=10000, label="Taraf", info="Choose the Taraf to Input", step = 1)
|
|
|
5 |
import pandas as pd
|
6 |
from datasets import load_dataset
|
7 |
from sklearn.metrics.pairwise import cosine_similarity
|
8 |
+
from datasets import Features, Value
|
9 |
import plotly.express as px
|
10 |
+
|
11 |
+
features = Features({'matn': Value('string'), 'taraf_ID': Value('string'), 'bookid_hadithid': Value('string')})
|
12 |
+
|
13 |
+
|
14 |
Secret_token = os.getenv('HF_token')
|
15 |
|
16 |
dataset = load_dataset("FDSRashid/embed_matn", token = Secret_token)
|
|
|
44 |
lower_triangle = matr[mask]
|
45 |
data = lower_triangle.flatten()
|
46 |
fig_dis = px.histogram(x = data, title = f'Similarity Distribution for Taraf {taraf_num}', labels = {'x': 'Similarity Score'}, nbins = 20, template = 'ggplot2' )
|
47 |
+
return fig, fig_dis, taraf_df[['matn', 'Number', 'Book_Name', 'Author', 'Hadith Number']]
|
48 |
|
49 |
with gr.Blocks() as demo:
|
50 |
taraf_number = gr.Slider(1,taraf_max , value=10000, label="Taraf", info="Choose the Taraf to Input", step = 1)
|