Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,7 @@ def respond(
|
|
66 |
messages.append({"role": "user", "content":user })
|
67 |
messages.append({"role": "assistant", "content": assistant})
|
68 |
except:
|
69 |
-
print("
|
70 |
|
71 |
#adding more references
|
72 |
df = pd.read_csv("moslem-bot-reference.csv", sep='|')
|
@@ -84,9 +84,13 @@ def respond(
|
|
84 |
#latest user question
|
85 |
from googletrans import Translator
|
86 |
translator = Translator()
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
messages.append({"role": "user", "content": en_message})
|
91 |
#print(messages)
|
92 |
|
|
|
66 |
messages.append({"role": "user", "content":user })
|
67 |
messages.append({"role": "assistant", "content": assistant})
|
68 |
except:
|
69 |
+
print("adding fatwa references exception occurred")
|
70 |
|
71 |
#adding more references
|
72 |
df = pd.read_csv("moslem-bot-reference.csv", sep='|')
|
|
|
84 |
#latest user question
|
85 |
from googletrans import Translator
|
86 |
translator = Translator()
|
87 |
+
en_message = ""
|
88 |
+
try:
|
89 |
+
message_language = translator.detect(message).lang
|
90 |
+
print(message_language)
|
91 |
+
en_message = translator.translate(message).text
|
92 |
+
except:
|
93 |
+
print("en_message exception occurred")
|
94 |
messages.append({"role": "user", "content": en_message})
|
95 |
#print(messages)
|
96 |
|