Skip to content
Snippets Groups Projects
Commit a564952f authored by Marc Roig Vilamala's avatar Marc Roig Vilamala
Browse files

Updated googletrans for ollama compatibility

parent 3b9d259c
No related branches found
No related tags found
1 merge request!1Demo branch
...@@ -4,5 +4,5 @@ transformers~=4.41.2 ...@@ -4,5 +4,5 @@ transformers~=4.41.2
ckip-transformers~=0.3.4 ckip-transformers~=0.3.4
flask-cors~=4.0.1 flask-cors~=4.0.1
spacy~=3.7.4 spacy~=3.7.4
googletrans ~=3.1.0a0 googletrans ~=4.0.2
pandas ~=2.2.3 pandas ~=2.2.3
\ No newline at end of file
...@@ -3,13 +3,14 @@ import csv ...@@ -3,13 +3,14 @@ import csv
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
import time import time
import asyncio
# wrapper for the googletrans library. Takes in chinese string returns english # wrapper for the googletrans library. Takes in chinese string returns english
def translate(word): def translate(word):
translator = Translator() translator = Translator()
result = translator.translate(word, src='zh-cn', dest='en') result = asyncio.run(translator.translate(word, src='zh-cn', dest='en'))
print('page from translate.py: ', result) print('page from translate.py: ', result)
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment