Spaces:
Sleeping
Sleeping
Commit
•
ad79c98
1
Parent(s):
44d18a1
Update api.py
Browse files
api.py
CHANGED
@@ -69,7 +69,7 @@ def send_to_backend():
|
|
69 |
|
70 |
print("Question: ", question)
|
71 |
|
72 |
-
|
73 |
#Request LlamaRAFT for answer#
|
74 |
url = "https://pretty-hounds-sip.loca.lt/chat"
|
75 |
data = {
|
@@ -85,7 +85,7 @@ def send_to_backend():
|
|
85 |
llamaanswer = response.json()['Answer']
|
86 |
else:
|
87 |
llamaanswer = ""
|
88 |
-
|
89 |
|
90 |
#GPTRAG
|
91 |
try:
|
@@ -101,10 +101,11 @@ def send_to_backend():
|
|
101 |
response_message = response_content.get('answer')
|
102 |
response_context = response_content.get('source_documents')
|
103 |
|
|
|
104 |
if llamaanswer != "":
|
105 |
response_message = llamaanswer
|
|
|
106 |
|
107 |
-
#P, R, F1 = score([response_message], [str(response_context)],lang="en")
|
108 |
documents = [response_message,str(response_context)]
|
109 |
F1 = cosine_similarity(TfidfVectorizer().fit_transform(documents), TfidfVectorizer().fit_transform(documents))
|
110 |
F1 = (F1[0][1]+0.3) / (np.linalg.norm(F1[0]))
|
|
|
69 |
|
70 |
print("Question: ", question)
|
71 |
|
72 |
+
"""
|
73 |
#Request LlamaRAFT for answer#
|
74 |
url = "https://pretty-hounds-sip.loca.lt/chat"
|
75 |
data = {
|
|
|
85 |
llamaanswer = response.json()['Answer']
|
86 |
else:
|
87 |
llamaanswer = ""
|
88 |
+
"""
|
89 |
|
90 |
#GPTRAG
|
91 |
try:
|
|
|
101 |
response_message = response_content.get('answer')
|
102 |
response_context = response_content.get('source_documents')
|
103 |
|
104 |
+
"""
|
105 |
if llamaanswer != "":
|
106 |
response_message = llamaanswer
|
107 |
+
"""
|
108 |
|
|
|
109 |
documents = [response_message,str(response_context)]
|
110 |
F1 = cosine_similarity(TfidfVectorizer().fit_transform(documents), TfidfVectorizer().fit_transform(documents))
|
111 |
F1 = (F1[0][1]+0.3) / (np.linalg.norm(F1[0]))
|