Skip to content
Snippets Groups Projects
Commit 773465c3 authored by Bartłomiej Bojanowski's avatar Bartłomiej Bojanowski
Browse files

Modify README and fix PredictLangWorker

parent bfde3ad5
Branches
Tags
2 merge requests!2Developer,!1Feature 257
Pipeline #1848 failed
......@@ -9,6 +9,6 @@ Use docker to build and run image:
```
docker build -t <name> .
docker run <name> -v "/samba:/samba"
docker run -v /samba:/samba <name>
```
import fasttext
import nlp_ws
class PredictLangWorker(nlp_ws.NLPWorker):
def __init__(self):
self.model = fasttext.load_model("lid.176.bin")
def process(self, input_file: str,
task_options: dict,
output_file: str) -> None:
def process(self, input_file: str, task_options: dict, output_file: str) -> None:
with open(input_file, "r") as f:
text = f.read().replace('\n',' ')
print(text)
predict = self.model.predict(text)[0][0]
with open(output_file, "w") as f:
f.write(predict)
return self.model.predict(str(text))
f.write(text+ predict)
print(predict)
return predict
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment