Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,12 @@ os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets['huggingface_token']
|
|
18 |
def trs_fa_to_en(text):
|
19 |
txt_en=translators.translate_text(text,to_language='en',from_language='auto')
|
20 |
return txt_en
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
def get_pdf_text(pdf_docs : list) -> str:
|
23 |
text = ""
|
24 |
for pdf in pdf_docs:
|
@@ -72,8 +77,11 @@ def handle_userinput(user_question:str):
|
|
72 |
st.write("سوال کاربر: " + message.content)
|
73 |
else:
|
74 |
st.write("پاسخ ربات: " + message.content)
|
|
|
|
|
|
|
75 |
|
76 |
-
|
77 |
|
78 |
def main():
|
79 |
st.set_page_config(
|
@@ -124,4 +132,4 @@ def main():
|
|
124 |
st.write("compelete build model")
|
125 |
|
126 |
if __name__ == "__main__":
|
127 |
-
main()
|
|
|
18 |
def trs_fa_to_en(text):
|
19 |
txt_en=translators.translate_text(text,to_language='en',from_language='auto')
|
20 |
return txt_en
|
21 |
+
#########################################################################################
|
22 |
+
def trs_en_to_fa(text):
|
23 |
+
txt_fa=translators.translate_text(text,to_language='fa',from_language='en')
|
24 |
+
return txt_fa
|
25 |
+
##############################################################################################
|
26 |
+
|
27 |
def get_pdf_text(pdf_docs : list) -> str:
|
28 |
text = ""
|
29 |
for pdf in pdf_docs:
|
|
|
77 |
st.write("سوال کاربر: " + message.content)
|
78 |
else:
|
79 |
st.write("پاسخ ربات: " + message.content)
|
80 |
+
text=message.content
|
81 |
+
txt_fa=trs_en_to_fa(text=text)
|
82 |
+
st.write("پاسخ ربات: " + txt_fa)
|
83 |
|
84 |
+
#############################################################################################################
|
85 |
|
86 |
def main():
|
87 |
st.set_page_config(
|
|
|
132 |
st.write("compelete build model")
|
133 |
|
134 |
if __name__ == "__main__":
|
135 |
+
main()
|