Commit
·
72d9615
1
Parent(s):
e25815f
Update handler.py
Browse files- handler.py +1 -6
handler.py
CHANGED
|
@@ -3,11 +3,6 @@ import os
|
|
| 3 |
os.system("pip install detectron2-0.6-cp310-cp310-linux_x86_64.whl")
|
| 4 |
os.system("pip install deepspeed==0.7.0")
|
| 5 |
|
| 6 |
-
import site
|
| 7 |
-
from importlib import reload
|
| 8 |
-
|
| 9 |
-
reload(site)
|
| 10 |
-
|
| 11 |
from PIL import Image
|
| 12 |
from io import BytesIO
|
| 13 |
import argparse
|
|
@@ -70,7 +65,7 @@ class EndpointHandler:
|
|
| 70 |
pass
|
| 71 |
|
| 72 |
|
| 73 |
-
def
|
| 74 |
image_array = np.array(image_file)[:, :, ::-1] # BGR
|
| 75 |
predictions, visualized_output = dense_captioning_demo.run_on_image(image_array)
|
| 76 |
buffer = BytesIO()
|
|
|
|
| 3 |
os.system("pip install detectron2-0.6-cp310-cp310-linux_x86_64.whl")
|
| 4 |
os.system("pip install deepspeed==0.7.0")
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
from io import BytesIO
|
| 8 |
import argparse
|
|
|
|
| 65 |
pass
|
| 66 |
|
| 67 |
|
| 68 |
+
def __call__(self, image_file):
|
| 69 |
image_array = np.array(image_file)[:, :, ::-1] # BGR
|
| 70 |
predictions, visualized_output = dense_captioning_demo.run_on_image(image_array)
|
| 71 |
buffer = BytesIO()
|