Skip to content

Commit

Permalink
003: Adding spacey lib
Browse files Browse the repository at this point in the history
  • Loading branch information
TharinduDR committed Apr 16, 2021
1 parent ed42fe0 commit 67ed8b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions mudes/app/mudes_app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import os

from spacy.lang.en import English
from spacy.lang.xx import MultiLanguage

from mudes.algo.mudes_model import MUDESModel
import logging
from google_drive_downloader import GoogleDriveDownloader as gdd

from mudes.algo.predict import predict_spans
from mudes.algo.preprocess import contiguous_ranges

Expand Down Expand Up @@ -42,12 +37,6 @@ def __init__(self, model_name_or_path, model_type=None, use_cuda=True, cuda_de
self.model = MUDESModel(model_type, self.model_name_or_path, labels=["NOT_TOXIC", "TOXIC"], use_cuda=self.use_cuda,
cuda_device=self.cuda_device)

@staticmethod
def _download(drive_id, model_name):
gdd.download_file_from_google_drive(file_id=drive_id,
dest_path= os.path.join(".mudes", model_name, "model.zip"),
unzip=True)

def predict_toxic_spans(self, text: str, spans: bool = False, language: str = "en"):
toxic_spans = predict_spans(self.model, text, language)
if spans:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="mudes",
version="0.2.1",
version="0.2.2",
author="Tharindu Ranasinghe",
author_email="[email protected]",
description="Toxic Spans Prediction",
Expand Down

0 comments on commit 67ed8b4

Please sign in to comment.