Bofandra commited on
Commit
fc50127
·
verified ·
1 Parent(s): c4baae7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,10 +3,10 @@ import pickle
3
  from sentence_transformers import SentenceTransformer
4
  import pandas as pd
5
 
6
- def greet(name):
7
  # transform query from user
8
  model = SentenceTransformer('use-cmlm-multilingual')
9
- encoded_query_text = model.encode(name)
10
 
11
  # get encoded quran text
12
  file = open('encoded_quran_cmlm.sav','rb')
@@ -28,9 +28,9 @@ def greet(name):
28
  sorted_quran = quran.sort_values(by='similarity', ascending=False)
29
  df_list = sorted_quran.values.tolist()
30
 
31
- return df_list['text'][0]
32
 
33
- demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
34
 
35
  if __name__ == "__main__":
36
  demo.launch()
 
3
  from sentence_transformers import SentenceTransformer
4
  import pandas as pd
5
 
6
+ def find(query):
7
  # transform query from user
8
  model = SentenceTransformer('use-cmlm-multilingual')
9
+ encoded_query_text = model.encode(query)
10
 
11
  # get encoded quran text
12
  file = open('encoded_quran_cmlm.sav','rb')
 
28
  sorted_quran = quran.sort_values(by='similarity', ascending=False)
29
  df_list = sorted_quran.values.tolist()
30
 
31
+ return df_list['text']
32
 
33
+ demo = gr.Interface(fn=find, inputs="textbox", outputs="textbox")
34
 
35
  if __name__ == "__main__":
36
  demo.launch()