ali121300 commited on
Commit
5838c96
1 Parent(s): a36742d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
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 MyMemoryTranslator
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
- text_to_translate = text1
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