fix windows gunicorn dependment.
@@ -26,12 +26,20 @@ import paddlehub as hub
from paddlehub.commands.base_command import BaseCommand, ENTRY
from paddlehub.serving import app_single as app
import multiprocessing
-import gunicorn.app.base
+if platform.system() == "Windows":
-def number_of_workers():
- return (multiprocessing.cpu_count() * 2) + 1
+ class StandaloneApplication(object):
+ def __init__(self):
+ pass
+ def load_config(self):
+ pass
+
+ def load(self):
+ pass
+else:
+ import gunicorn.app.base
class StandaloneApplication(gunicorn.app.base.BaseApplication):
def __init__(self, app, options=None):
@@ -52,6 +60,10 @@ class StandaloneApplication(gunicorn.app.base.BaseApplication):
return self.application
+def number_of_workers():
+ return (multiprocessing.cpu_count() * 2) + 1
+
+
class ServingCommand(BaseCommand):
name = "serving"
module_list = []
