Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def respond(
|
|
| 49 |
scores = (query_embeddings @ encoded_questions.T) * 100
|
| 50 |
selected_references['similarity'] = scores.tolist()[0]
|
| 51 |
sorted_references = selected_references.sort_values(by='similarity', ascending=False)
|
| 52 |
-
sorted_references = sorted_references.head(
|
| 53 |
sorted_references = selected_references.sort_values(by='similarity', ascending=True)
|
| 54 |
|
| 55 |
from googletrans import Translator
|
|
@@ -60,7 +60,7 @@ def respond(
|
|
| 60 |
print(f'{row["user"]}')
|
| 61 |
user = translator.translate(f'{row["user"]}', src='ar', dest='en').text
|
| 62 |
print(user)
|
| 63 |
-
print(row['assistant'])
|
| 64 |
assistant = translator.translate(row['assistant']).text
|
| 65 |
print(assistant)
|
| 66 |
messages.append({"role": "user", "content":user })
|
|
@@ -75,7 +75,7 @@ def respond(
|
|
| 75 |
|
| 76 |
#latest user question
|
| 77 |
messages.append({"role": "user", "content": message})
|
| 78 |
-
print(messages)
|
| 79 |
|
| 80 |
response = ""
|
| 81 |
|
|
|
|
| 49 |
scores = (query_embeddings @ encoded_questions.T) * 100
|
| 50 |
selected_references['similarity'] = scores.tolist()[0]
|
| 51 |
sorted_references = selected_references.sort_values(by='similarity', ascending=False)
|
| 52 |
+
sorted_references = sorted_references.head(1)
|
| 53 |
sorted_references = selected_references.sort_values(by='similarity', ascending=True)
|
| 54 |
|
| 55 |
from googletrans import Translator
|
|
|
|
| 60 |
print(f'{row["user"]}')
|
| 61 |
user = translator.translate(f'{row["user"]}', src='ar', dest='en').text
|
| 62 |
print(user)
|
| 63 |
+
#print(row['assistant'])
|
| 64 |
assistant = translator.translate(row['assistant']).text
|
| 65 |
print(assistant)
|
| 66 |
messages.append({"role": "user", "content":user })
|
|
|
|
| 75 |
|
| 76 |
#latest user question
|
| 77 |
messages.append({"role": "user", "content": message})
|
| 78 |
+
#print(messages)
|
| 79 |
|
| 80 |
response = ""
|
| 81 |
|