Skip to content

Commit

Permalink
Type fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vladd-bit committed Feb 1, 2024
1 parent c3adf8e commit 8a71b8d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 3 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os


def post_fork(server, worker):
server.log.info("Worker spawned (pid: %s)", worker.pid)
cuda_device_count = int(os.getenv("APP_CUDA_DEVICE_COUNT", -1))
Expand All @@ -15,4 +17,4 @@ def post_fork(server, worker):
else:
worker.log.info("APP_CUDA_DEVICE_COUNT device variables not set")


6 changes: 3 additions & 3 deletions medcat_service/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import sys

import injector
from flask_injector import FlaskInjector
from flask import Flask
from flask_injector import FlaskInjector

from medcat_service.api import api
from medcat_service.nlp_processor import MedCatProcessor
Expand Down Expand Up @@ -51,9 +51,9 @@ def create_app():
def configure(binder):
binder.bind(MedCatProcessor, to=MedCatProcessor, scope=injector.singleton)
binder.bind(NlpService, to=MedCatService, scope=injector.singleton)


FlaskInjector(app=app, modules=[configure])

# remember to return the app
return app
10 changes: 4 additions & 6 deletions medcat_service/nlp_processor/medcat_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@

import logging
import os
from datetime import datetime, timezone
import time
from datetime import datetime, timezone

import simplejson as json
import injector

from medcat.cat import CAT
from medcat.cdb import CDB
from medcat.meta_cat import MetaCAT
from medcat.utils.ner.deid import DeIdModel
from medcat.vocab import Vocab

from medcat.utils.ner.deid import DeIdModel

class NlpProcessor:
"""
Expand Down Expand Up @@ -68,7 +66,7 @@ def __init__(self):
self.bulk_nproc = int(os.getenv("APP_BULK_NPROC", 8))
self.torch_threads = int(os.getenv("APP_TORCH_THREADS", -1))
self.DEID_MODE = os.getenv("DEID_MODE", False)

# this is available to constrain torch threads when there
# isn't a GPU
# You probably want to set to 1
Expand All @@ -81,7 +79,7 @@ def __init__(self):
self.cat = self._create_cat()
self.cat.train = os.getenv("APP_TRAINING_MODE", False)


self.log.info("MedCAT processor is ready")

def get_app_info(self):
Expand Down

0 comments on commit 8a71b8d

Please sign in to comment.