Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ def find(query):
|
|
9 |
encoded_query_text = model.encode(query)
|
10 |
|
11 |
# get encoded quran text
|
12 |
-
file = open('
|
13 |
encoded_quran_text = pickle.load(file)
|
14 |
file.close()
|
15 |
|
@@ -23,14 +23,20 @@ def find(query):
|
|
23 |
print(i)
|
24 |
|
25 |
# insert the similarity value to dataframe & sort it
|
26 |
-
|
27 |
-
|
|
|
28 |
sorted_quran = quran.sort_values(by='similarity', ascending=False)
|
29 |
|
|
|
|
|
|
|
30 |
results = ""
|
31 |
i = 0
|
32 |
while i<6:
|
33 |
-
|
|
|
|
|
34 |
i=i+1
|
35 |
|
36 |
return results
|
|
|
9 |
encoded_query_text = model.encode(query)
|
10 |
|
11 |
# get encoded quran text
|
12 |
+
file = open('encoded_quran_fine-tuning-use-cmlm-multilingual-quran-splitted.sav','rb')
|
13 |
encoded_quran_text = pickle.load(file)
|
14 |
file.close()
|
15 |
|
|
|
23 |
print(i)
|
24 |
|
25 |
# insert the similarity value to dataframe & sort it
|
26 |
+
file = open('quran-splitted.sav','rb')
|
27 |
+
quran_splitted = pickle.load(file)
|
28 |
+
quran_splitted['similarity'] = text_similarity
|
29 |
sorted_quran = quran.sort_values(by='similarity', ascending=False)
|
30 |
|
31 |
+
# insert the similarity value to dataframe & sort it
|
32 |
+
quran = pd.read_csv('quran-simple-clean.txt', delimiter="|")
|
33 |
+
|
34 |
results = ""
|
35 |
i = 0
|
36 |
while i<6:
|
37 |
+
result = sorted_quran.iloc[i]
|
38 |
+
result_quran = quran.loc[(quran['sura']==result['sura']) & (teks['aya']==result['aya'])]
|
39 |
+
results = results + result_quran['text']+" (Q.S "+str(result['sura'])+":"+str(result['aya'])+")\n"
|
40 |
i=i+1
|
41 |
|
42 |
return results
|