Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
import pandas as pd
|
|
|
4 |
|
5 |
def find(query):
|
6 |
def get_detailed_instruct(task_description: str, query: str) -> str:
|
@@ -13,7 +14,7 @@ def find(query):
|
|
13 |
]
|
14 |
|
15 |
quran = pd.read_csv('quran-simple-clean.txt', delimiter="|")
|
16 |
-
file = open('
|
17 |
document_embeddings = pickle.load(file)
|
18 |
|
19 |
model = SentenceTransformer('intfloat/multilingual-e5-large-instruct')
|
@@ -21,8 +22,10 @@ def find(query):
|
|
21 |
scores = (query_embeddings @ document_embeddings.T) * 100
|
22 |
|
23 |
# insert the similarity value to dataframe & sort it
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
|
27 |
results = ""
|
28 |
i = 0
|
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
import pandas as pd
|
4 |
+
import pickle
|
5 |
|
6 |
def find(query):
|
7 |
def get_detailed_instruct(task_description: str, query: str) -> str:
|
|
|
14 |
]
|
15 |
|
16 |
quran = pd.read_csv('quran-simple-clean.txt', delimiter="|")
|
17 |
+
file = open('encoded_quran_text_split_multilingual-e5-large-instruct.sav','rb')
|
18 |
document_embeddings = pickle.load(file)
|
19 |
|
20 |
model = SentenceTransformer('intfloat/multilingual-e5-large-instruct')
|
|
|
22 |
scores = (query_embeddings @ document_embeddings.T) * 100
|
23 |
|
24 |
# insert the similarity value to dataframe & sort it
|
25 |
+
file = open('quran-splitted.sav','rb')
|
26 |
+
quran_splitted = pickle.load(file)
|
27 |
+
quran_splitted['similarity'] = scores.tolist()[0]
|
28 |
+
sorted_quran = quran_splitted.sort_values(by='similarity', ascending=False)
|
29 |
|
30 |
results = ""
|
31 |
i = 0
|