Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import torch
|
2 |
from transformers import CLIPProcessor, CLIPModel
|
3 |
|
4 |
-
class
|
5 |
def __init__(self):
|
6 |
# Load model and processor
|
7 |
self.model = CLIPModel.from_pretrained("dazpye/clip-image")
|
@@ -23,7 +23,7 @@ class ModelHandler:
|
|
23 |
# Convert output to readable format
|
24 |
return {"predictions": inference_output}
|
25 |
|
26 |
-
handler =
|
27 |
|
28 |
def handle(request):
|
29 |
inputs = request if isinstance(request, dict) else request.json()
|
|
|
1 |
import torch
|
2 |
from transformers import CLIPProcessor, CLIPModel
|
3 |
|
4 |
+
class EndpointHandler:
|
5 |
def __init__(self):
|
6 |
# Load model and processor
|
7 |
self.model = CLIPModel.from_pretrained("dazpye/clip-image")
|
|
|
23 |
# Convert output to readable format
|
24 |
return {"predictions": inference_output}
|
25 |
|
26 |
+
handler = EndpointHandler()
|
27 |
|
28 |
def handle(request):
|
29 |
inputs = request if isinstance(request, dict) else request.json()
|