Thomas Male
commited on
Update handler.py
Browse files- handler.py +13 -1
handler.py
CHANGED
@@ -23,7 +23,10 @@ class EndpointHandler():
|
|
23 |
def __init__(self, path=""):
|
24 |
# load the optimized model
|
25 |
print('creating base model...')
|
26 |
-
|
|
|
|
|
|
|
27 |
self.base_model = model_from_config(MODEL_CONFIGS[self.base_name], device)
|
28 |
self.base_model.eval()
|
29 |
self.base_diffusion = diffusion_from_config(DIFFUSION_CONFIGS[self.base_name])
|
@@ -47,6 +50,15 @@ class EndpointHandler():
|
|
47 |
Return:
|
48 |
A :obj:`dict`:. plotly json Data
|
49 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
inputs = data.pop("inputs", data)
|
51 |
|
52 |
sampler = PointCloudSampler(
|
|
|
23 |
def __init__(self, path=""):
|
24 |
# load the optimized model
|
25 |
print('creating base model...')
|
26 |
+
|
27 |
+
#self.base_name = 'base40M-textvec'
|
28 |
+
self.base_name = 'base40M'
|
29 |
+
|
30 |
self.base_model = model_from_config(MODEL_CONFIGS[self.base_name], device)
|
31 |
self.base_model.eval()
|
32 |
self.base_diffusion = diffusion_from_config(DIFFUSION_CONFIGS[self.base_name])
|
|
|
50 |
Return:
|
51 |
A :obj:`dict`:. plotly json Data
|
52 |
"""
|
53 |
+
|
54 |
+
#Checks if an image key has been provided, and if so, uses the image data instead of text input
|
55 |
+
if "image" in data:
|
56 |
+
image_data = data.pop("image")
|
57 |
+
use_image = True
|
58 |
+
print('image data found')
|
59 |
+
else
|
60 |
+
print('no image data found')
|
61 |
+
|
62 |
inputs = data.pop("inputs", data)
|
63 |
|
64 |
sampler = PointCloudSampler(
|