Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,7 @@ from langchain.memory import ConversationBufferMemory
|
|
10 |
from langchain.chains import ConversationalRetrievalChain
|
11 |
from htmlTemplates import css, bot_template, user_template
|
12 |
from langchain.llms import HuggingFaceHub
|
13 |
-
from deep_translator import
|
14 |
-
|
15 |
|
16 |
# set this key as an environment variable
|
17 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets['huggingface_token']
|
@@ -71,11 +70,9 @@ def handle_userinput(user_question:str):
|
|
71 |
else:
|
72 |
st.write("پاسخ ربات: " + message.content)
|
73 |
text1=message.content
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
translated_text = MyMemoryTranslator(source='english', target='persian').translate(text_to_translate)
|
78 |
-
st.write(translated_text)
|
79 |
|
80 |
#############################################################################################################
|
81 |
|
|
|
10 |
from langchain.chains import ConversationalRetrievalChain
|
11 |
from htmlTemplates import css, bot_template, user_template
|
12 |
from langchain.llms import HuggingFaceHub
|
13 |
+
from deep_translator import GoogleTranslator
|
|
|
14 |
|
15 |
# set this key as an environment variable
|
16 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets['huggingface_token']
|
|
|
70 |
else:
|
71 |
st.write("پاسخ ربات: " + message.content)
|
72 |
text1=message.content
|
73 |
+
translator = GoogleTranslator(source='english', target='persian')
|
74 |
+
result = translator.translate(text1)
|
75 |
+
st.write(result)
|
|
|
|
|
76 |
|
77 |
#############################################################################################################
|
78 |
|