Morgan Funtowicz
commited on
Commit
·
a6ada40
1
Parent(s):
49b79e1
fix(import): remove unused imports
Browse files- handler.py +7 -2
handler.py
CHANGED
@@ -4,7 +4,6 @@ from typing import Tuple, List
|
|
4 |
import numpy as np
|
5 |
import torch
|
6 |
from hfendpoints.http import Context, run
|
7 |
-
from hfendpoints.openai.embedding import EmbeddingEndpoint
|
8 |
from hfendpoints.tasks import Usage
|
9 |
from hfendpoints.tasks.embedding import EmbeddingRequest, EmbeddingResponse
|
10 |
from intel_extension_for_pytorch.cpu.runtime import pin
|
@@ -129,11 +128,17 @@ class SentenceTransformerHandler(Handler):
|
|
129 |
|
130 |
|
131 |
def entrypoint():
|
|
|
132 |
config = EndpointConfig.from_env()
|
133 |
|
134 |
logger.info(f"[Hugging Face Endpoint v{__version__}] Serving: {config.model_id}")
|
135 |
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
137 |
run(endpoint, config.interface, config.port)
|
138 |
|
139 |
|
|
|
4 |
import numpy as np
|
5 |
import torch
|
6 |
from hfendpoints.http import Context, run
|
|
|
7 |
from hfendpoints.tasks import Usage
|
8 |
from hfendpoints.tasks.embedding import EmbeddingRequest, EmbeddingResponse
|
9 |
from intel_extension_for_pytorch.cpu.runtime import pin
|
|
|
128 |
|
129 |
|
130 |
def entrypoint():
|
131 |
+
# Readout the endpoint configuration from the provided environment variable
|
132 |
config = EndpointConfig.from_env()
|
133 |
|
134 |
logger.info(f"[Hugging Face Endpoint v{__version__}] Serving: {config.model_id}")
|
135 |
|
136 |
+
# Allocate handler
|
137 |
+
handler = SentenceTransformerHandler(config)
|
138 |
+
|
139 |
+
# Allocate endpoint
|
140 |
+
from hfendpoints.hfinference.embedding import EmbeddingEndpoint
|
141 |
+
endpoint = EmbeddingEndpoint(handler)
|
142 |
run(endpoint, config.interface, config.port)
|
143 |
|
144 |
|