Update sentence_compare.py
Browse files- sentence_compare.py +0 -10
sentence_compare.py
CHANGED
@@ -1,21 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
import urllib.request, json
|
3 |
from transformers.utils import logging
|
4 |
logging.set_verbosity_error()
|
5 |
|
6 |
from sentence_transformers import SentenceTransformer
|
7 |
from sentence_transformers import util
|
8 |
|
9 |
-
# Search URL for Mackabee Ministries scriptures. Will fetch scriptures as a json object.
|
10 |
-
SEARCH_URL = 'https://dd4-biblical.appspot.com/_api/scriptures/v1/search?searchText={}&lang=en&version={}'
|
11 |
-
STANDARD_VERSION = 'RSKJ' # Normally RSKJ (Restored King James Version) as our standard text, may also use NRSV.
|
12 |
-
COMPARISON_VERSION = 'SEP' # Will use the Septuagint "SEP" version for most comparisons, also have DSS available for Isa
|
13 |
-
|
14 |
-
|
15 |
def compare(input):
|
16 |
-
with urllib.request.urlopen(SEARCH_URL.format(urllib.parse.quote(input), STANDARD_VERSION)) as url:
|
17 |
-
response = json.load(url)
|
18 |
-
return response
|
19 |
lines = input.splitlines()
|
20 |
embeddings1 = model.encode(lines[0], convert_to_tensor=True)
|
21 |
embeddings2 = model.encode(lines[1], convert_to_tensor=True)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers.utils import logging
|
3 |
logging.set_verbosity_error()
|
4 |
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
from sentence_transformers import util
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def compare(input):
|
|
|
|
|
|
|
9 |
lines = input.splitlines()
|
10 |
embeddings1 = model.encode(lines[0], convert_to_tensor=True)
|
11 |
embeddings2 = model.encode(lines[1], convert_to_tensor=True)
|