bizyengine 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. bizyengine/__init__.py +35 -0
  2. bizyengine/bizy_server/__init__.py +7 -0
  3. bizyengine/bizy_server/api_client.py +763 -0
  4. bizyengine/bizy_server/errno.py +122 -0
  5. bizyengine/bizy_server/error_handler.py +3 -0
  6. bizyengine/bizy_server/execution.py +55 -0
  7. bizyengine/bizy_server/resp.py +24 -0
  8. bizyengine/bizy_server/server.py +898 -0
  9. bizyengine/bizy_server/utils.py +93 -0
  10. bizyengine/bizyair_extras/__init__.py +24 -0
  11. bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py +62 -0
  12. bizyengine/bizyair_extras/nodes_cogview4.py +31 -0
  13. bizyengine/bizyair_extras/nodes_comfyui_detail_daemon.py +180 -0
  14. bizyengine/bizyair_extras/nodes_comfyui_instantid.py +164 -0
  15. bizyengine/bizyair_extras/nodes_comfyui_layerstyle_advance.py +141 -0
  16. bizyengine/bizyair_extras/nodes_comfyui_pulid_flux.py +88 -0
  17. bizyengine/bizyair_extras/nodes_controlnet.py +50 -0
  18. bizyengine/bizyair_extras/nodes_custom_sampler.py +130 -0
  19. bizyengine/bizyair_extras/nodes_dataset.py +99 -0
  20. bizyengine/bizyair_extras/nodes_differential_diffusion.py +16 -0
  21. bizyengine/bizyair_extras/nodes_flux.py +69 -0
  22. bizyengine/bizyair_extras/nodes_image_utils.py +93 -0
  23. bizyengine/bizyair_extras/nodes_ip2p.py +20 -0
  24. bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py +1 -0
  25. bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py +1598 -0
  26. bizyengine/bizyair_extras/nodes_janus_pro.py +81 -0
  27. bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py +86 -0
  28. bizyengine/bizyair_extras/nodes_model_advanced.py +62 -0
  29. bizyengine/bizyair_extras/nodes_sd3.py +52 -0
  30. bizyengine/bizyair_extras/nodes_segment_anything.py +256 -0
  31. bizyengine/bizyair_extras/nodes_segment_anything_utils.py +134 -0
  32. bizyengine/bizyair_extras/nodes_testing_utils.py +139 -0
  33. bizyengine/bizyair_extras/nodes_trellis.py +199 -0
  34. bizyengine/bizyair_extras/nodes_ultimatesdupscale.py +137 -0
  35. bizyengine/bizyair_extras/nodes_upscale_model.py +32 -0
  36. bizyengine/bizyair_extras/nodes_wan_video.py +49 -0
  37. bizyengine/bizyair_extras/oauth_callback/main.py +118 -0
  38. bizyengine/core/__init__.py +8 -0
  39. bizyengine/core/commands/__init__.py +1 -0
  40. bizyengine/core/commands/base.py +27 -0
  41. bizyengine/core/commands/invoker.py +4 -0
  42. bizyengine/core/commands/processors/model_hosting_processor.py +0 -0
  43. bizyengine/core/commands/processors/prompt_processor.py +123 -0
  44. bizyengine/core/commands/servers/model_server.py +0 -0
  45. bizyengine/core/commands/servers/prompt_server.py +234 -0
  46. bizyengine/core/common/__init__.py +8 -0
  47. bizyengine/core/common/caching.py +198 -0
  48. bizyengine/core/common/client.py +262 -0
  49. bizyengine/core/common/env_var.py +101 -0
  50. bizyengine/core/common/utils.py +93 -0
  51. bizyengine/core/configs/conf.py +112 -0
  52. bizyengine/core/configs/models.json +101 -0
  53. bizyengine/core/configs/models.yaml +329 -0
  54. bizyengine/core/data_types.py +20 -0
  55. bizyengine/core/image_utils.py +288 -0
  56. bizyengine/core/nodes_base.py +159 -0
  57. bizyengine/core/nodes_io.py +97 -0
  58. bizyengine/core/path_utils/__init__.py +9 -0
  59. bizyengine/core/path_utils/path_manager.py +276 -0
  60. bizyengine/core/path_utils/utils.py +34 -0
  61. bizyengine/misc/__init__.py +0 -0
  62. bizyengine/misc/auth.py +83 -0
  63. bizyengine/misc/llm.py +431 -0
  64. bizyengine/misc/mzkolors.py +93 -0
  65. bizyengine/misc/nodes.py +1208 -0
  66. bizyengine/misc/nodes_controlnet_aux.py +491 -0
  67. bizyengine/misc/nodes_controlnet_union_sdxl.py +171 -0
  68. bizyengine/misc/route_sam.py +60 -0
  69. bizyengine/misc/segment_anything.py +276 -0
  70. bizyengine/misc/supernode.py +182 -0
  71. bizyengine/misc/utils.py +218 -0
  72. bizyengine/version.txt +1 -0
  73. bizyengine-0.4.2.dist-info/METADATA +12 -0
  74. bizyengine-0.4.2.dist-info/RECORD +76 -0
  75. bizyengine-0.4.2.dist-info/WHEEL +5 -0
  76. bizyengine-0.4.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,122 @@
1
+ class ErrorNo:
2
+ def __init__(self, http_status_code, code, payload, message):
3
+ self.http_status_code = http_status_code
4
+ self.code = code
5
+ self.message = message
6
+ self.data = payload
7
+
8
+ def copy(self):
9
+ return ErrorNo(self.http_status_code, self.code, self.data, self.message)
10
+
11
+
12
+ class errnos:
13
+ OK = ErrorNo(200, 20000, None, "Success")
14
+ NO_MODEL_FOUND = ErrorNo(404, 20226, None, "No model found")
15
+
16
+ INVALID_TYPE = ErrorNo(400, 400100, None, "Invalid model type")
17
+ INVALID_NAME = ErrorNo(400, 400101, None, "Invalid model name")
18
+ NO_FILE_UPLOAD = ErrorNo(400, 400102, None, "No file to upload")
19
+ EMPTY_UPLOAD_ID = ErrorNo(400, 400103, None, "Upload id is empty")
20
+ INVALID_SHARE_ID = ErrorNo(400, 400104, None, "Invalid share id")
21
+ EMPTY_ABS_PATH = ErrorNo(400, 400111, None, "The upload path cannot be empty")
22
+ NO_ABS_PATH = ErrorNo(400, 400112, None, "The upload path is not an absolute path")
23
+ PATH_NOT_EXISTS = ErrorNo(400, 400113, None, "The upload path does not exist")
24
+ INVALID_CLIENT_ID = ErrorNo(400, 400114, None, "Invalid client id")
25
+ NO_PUBLIC_FLAG = ErrorNo(
26
+ 400, 400115, None, 'The parameter "public" is not provided'
27
+ )
28
+ FILE_NOT_EXISTS = ErrorNo(400, 400116, None, "The file does not exist")
29
+ NO_SHARE_ID = ErrorNo(400, 400117, None, 'The parameter "share_id" is not provided')
30
+ INVALID_DESCRIPTION = ErrorNo(400, 400118, None, "Invalid description")
31
+ NOT_A_FILE = ErrorNo(400, 400119, None, "The path is not a file")
32
+ NOT_ALLOWED_EXT_NAME = ErrorNo(400, 400120, None, "Not allowed extension name")
33
+ INVALID_UPLOAD_ID = ErrorNo(400, 400121, None, "Invalid upload id")
34
+ INVALID_VERSIONS = ErrorNo(400, 400122, None, "Invalid versions")
35
+ DUPLICATE_VERSION = ErrorNo(400, 400123, None, "Duplicate version")
36
+ INVALID_VERSION_FIELD = ErrorNo(400, 400124, None, "Invalid version field")
37
+ INVALID_QUERY_MODE = ErrorNo(400, 400125, None, "Invalid query mode")
38
+ INVALID_VERSION_NAME = ErrorNo(400, 400126, None, "Invalid model version name")
39
+ INVALID_MODEL_ID = ErrorNo(400, 400127, None, "Invalid model id")
40
+ INVALID_MODEL_VERSION_ID = ErrorNo(400, 400128, None, "Invalid model version id")
41
+ UNSUPPORT_LIKE_TYPE = ErrorNo(400, 400130, None, "Unsupport like type")
42
+ INVALID_SIGN = ErrorNo(400, 400131, None, "Invalid file sign")
43
+ EMPTY_SHA256SUM = ErrorNo(400, 400132, None, "Empty sha256sum")
44
+ INVALID_OBJECT_KEY = ErrorNo(400, 400133, None, "Invalid object key")
45
+ FAILED_TO_FETCH_WORKFLOW_JSON = ErrorNo(
46
+ 400, 400134, None, "Failed to fetch workflow json"
47
+ )
48
+ INVALID_DATASET_NAME = ErrorNo(400, 400135, None, "Invalid dataset name")
49
+ INVALID_DATASET_VERSION = ErrorNo(400, 400136, None, "Invalid dataset version")
50
+ INVALID_DATASET_ID = ErrorNo(400, 400137, None, "Invalid dataset id")
51
+ INVALID_DATASET_VERSION_ID = ErrorNo(
52
+ 400, 400138, None, "Invalid dataset version id"
53
+ )
54
+ INVALID_SHARE_BIZ_ID = ErrorNo(400, 400139, None, "Invalid share biz id")
55
+ INVALID_SHARE_TYPE = ErrorNo(400, 400140, None, "Invalid share type")
56
+ INVALID_SHARE_CODE = ErrorNo(400, 400141, None, "Invalid share code")
57
+ INVALID_NOTIF_ID = ErrorNo(400, 400142, None, "Invalid notification id")
58
+
59
+ INVALID_API_KEY = ErrorNo(401, 401000, None, "Invalid API key")
60
+ INVALID_USER = ErrorNo(401, 401001, None, "Invalid user")
61
+
62
+ SIGN_FILE = ErrorNo(500, 500101, None, "Failed to sign file")
63
+ UPLOAD = ErrorNo(500, 500102, None, "Failed to upload file")
64
+ COMMIT_FILE = ErrorNo(500, 500103, None, "Failed to commit file")
65
+ COMMIT_BIZY_MODEL = ErrorNo(500, 500105, None, "Failed to commit model")
66
+ EMPTY_FILES = ErrorNo(500, 500107, None, "Empty files to make a model")
67
+ LIST_MODEL_FILE = ErrorNo(500, 500108, None, "Failed to list model file")
68
+ LIST_SHARE_MODEL_FILE = ErrorNo(
69
+ 500, 500108, None, "Failed to list share model file"
70
+ )
71
+ INVALID_FILENAME = ErrorNo(500, 500109, None, "Invalid filename")
72
+ DELETE_MODEL = ErrorNo(500, 500110, None, "Failed to delete model")
73
+ GET_USER_INFO = ErrorNo(500, 500111, None, "Failed to get user info")
74
+ LIST_MODEL = ErrorNo(500, 500112, None, "Failed to list model")
75
+ CHANGE_PUBLIC = ErrorNo(500, 500113, None, "Failed to change public")
76
+ UPDATE_SHARE_ID = ErrorNo(500, 500114, None, "Failed to update share id")
77
+ GET_DESCRIPTION = ErrorNo(500, 500115, None, "Failed to get description")
78
+ UPDATE_DESCRIPTION = ErrorNo(500, 500116, None, "Failed to update description")
79
+ DELETE_BIZY_MODEL = ErrorNo(500, 500117, None, "Failed to delete model")
80
+ QUERY_COMMUNITY_MODELS = ErrorNo(
81
+ 500, 500118, None, "Failed to query community models"
82
+ )
83
+ QUERY_MODELS = ErrorNo(500, 500119, None, "Failed to query models")
84
+ GET_MODEL_DETAIL = ErrorNo(500, 500120, None, "Failed to get model detail")
85
+ GET_MODEL_VERSION_DETAIL = ErrorNo(
86
+ 500, 500121, None, "Failed to get model version detail"
87
+ )
88
+ FORK_MODEL_VERSION = ErrorNo(500, 500122, None, "Failed to fork model version")
89
+ UPDATE_MODEL = ErrorNo(500, 500123, None, "Failed to update model")
90
+ GET_UPLOAD_TOKEN = ErrorNo(500, 500124, None, "Failed to get upload token")
91
+ TOGGLE_USER_LIKE = ErrorNo(500, 500125, None, "Failed to toggle user like")
92
+ GET_DOWNLOAD_URL = ErrorNo(500, 500126, None, "Failed to get download url")
93
+ DOWNLOAD_JSON = ErrorNo(500, 500127, None, "Failed to download json")
94
+ LIST_SHARE_MODEL_FILE_ERR = ErrorNo(
95
+ 500, 500128, None, "Failed to list share model file"
96
+ )
97
+ QUERY_OFFICIAL_MODELS = ErrorNo(
98
+ 500, 500129, None, "Failed to query official models"
99
+ )
100
+ UNFORK_MODEL_VERSION = ErrorNo(500, 500130, None, "Failed to unfork model version")
101
+
102
+ COMMIT_DATASET = ErrorNo(500, 500130, None, "Failed to commit dataset")
103
+ UPDATE_DATASET = ErrorNo(500, 500131, None, "Failed to update dataset")
104
+ GET_DATASET_VERSION_DETAIL = ErrorNo(
105
+ 500, 500132, None, "Failed to get dataset version detail"
106
+ )
107
+ DELETE_DATASET = ErrorNo(500, 500133, None, "Failed to delete dataset")
108
+ QUERY_DATASETS = ErrorNo(500, 500134, None, "Failed to query datasets")
109
+ GET_DATASET_DETAIL = ErrorNo(500, 500135, None, "Failed to get dataset detail")
110
+ CREATE_SHARE = ErrorNo(500, 500136, None, "Failed to create share")
111
+ GET_SHARE_DETAIL = ErrorNo(500, 500137, None, "Failed to get share detail")
112
+
113
+ GET_DATA_DICT = ErrorNo(500, 500138, None, "Failed to get data dict")
114
+
115
+ GET_NOTIF_UNREAD_COUNT = ErrorNo(
116
+ 500, 500139, None, "Failed to get notification unread counts"
117
+ )
118
+ QUERY_NOTIF = ErrorNo(500, 500140, None, "Failed to query notifications")
119
+ READ_NOTIF = ErrorNo(500, 500141, None, "Failed to mark notifications as read")
120
+ READ_ALL_NOTIF = ErrorNo(
121
+ 500, 500142, None, "Failed to mark all notifications as read"
122
+ )
@@ -0,0 +1,3 @@
1
+ class ErrorHandler:
2
+ def handle_error(self, error_code, message=None, data=None):
3
+ return {"code": error_code, "message": message or "", "data": data or {}}
@@ -0,0 +1,55 @@
1
+ import asyncio
2
+ import copy
3
+ import heapq
4
+ import logging
5
+ import threading
6
+
7
+
8
+ class UploadQueue:
9
+ def __init__(self):
10
+ self.mutex = threading.RLock()
11
+ self.not_empty = threading.Condition(self.mutex)
12
+ self.task_counter = 0
13
+ self.queue = []
14
+ self.currently_running = {}
15
+
16
+ def put(self, item):
17
+ with self.mutex:
18
+ heapq.heappush(self.queue, item)
19
+ self.not_empty.notify()
20
+
21
+ def get(self, timeout=None):
22
+ with self.not_empty:
23
+ while len(self.queue) == 0:
24
+ self.not_empty.wait(timeout=timeout)
25
+ if timeout is not None and len(self.queue) == 0:
26
+ return None
27
+ item = heapq.heappop(self.queue)
28
+ # i = self.task_counter
29
+ upload_id = item["upload_id"]
30
+ self.currently_running[upload_id] = copy.deepcopy(item)
31
+ self.task_counter += 1
32
+ return (item, upload_id)
33
+
34
+ def task_done(self, upload_id):
35
+ with self.mutex:
36
+ self.currently_running.pop(upload_id)
37
+
38
+
39
+ def upload_worker(server, q):
40
+ timeout = 1000.0
41
+ loop = asyncio.new_event_loop()
42
+ asyncio.set_event_loop(loop)
43
+
44
+ while True:
45
+ try:
46
+ queue_item = q.get(timeout=timeout)
47
+ if queue_item is not None:
48
+ item, upload_id = queue_item
49
+ loop = asyncio.get_event_loop()
50
+ loop.run_until_complete(server.upload_manager.do_upload(item))
51
+ q.task_done(upload_id)
52
+ else:
53
+ continue
54
+ except Exception as e:
55
+ logging.error(f"Failed to upload file: {e}")
@@ -0,0 +1,24 @@
1
+ from aiohttp import web
2
+
3
+ from .errno import ErrorNo, errnos
4
+
5
+
6
+ def JsonResponse(http_status_code, data):
7
+ return web.json_response(
8
+ data,
9
+ status=http_status_code,
10
+ content_type="application/json",
11
+ )
12
+
13
+
14
+ def OKResponse(data):
15
+ return JsonResponse(
16
+ 200, {"message": "success", "code": errnos.OK.code, "data": data}
17
+ )
18
+
19
+
20
+ def ErrResponse(err: ErrorNo):
21
+ return JsonResponse(
22
+ err.http_status_code,
23
+ {"message": err.message, "code": err.code, "data": err.data},
24
+ )