Dramb commited on
Commit
9e465d2
·
verified ·
1 Parent(s): ab26132

Delete inference.py

Browse files
Files changed (1) hide show
  1. inference.py +0 -34
inference.py DELETED
@@ -1,34 +0,0 @@
1
- from PIL import Image
2
- import numpy as np
3
- import base64
4
- from io import BytesIO
5
-
6
- class Pipeline:
7
- def __init__(self, path=""):
8
- print("Pipeline initialized")
9
-
10
- def __call__(self, inputs):
11
- image_data = inputs.get("image")
12
-
13
- if isinstance(image_data, str):
14
- image_bytes = base64.b64decode(image_data)
15
- image = Image.open(BytesIO(image_bytes))
16
- else:
17
- return {"error": "No image provided"}
18
-
19
- width, height = image.size
20
-
21
- # Пример простой маски: прямоугольник по центру
22
- mask = np.zeros((height, width), dtype=np.uint8)
23
- mask[height//4: 3*height//4, width//4: 3*width//4] = 1
24
-
25
- # Преобразуем в обычный Python-список
26
- mask_list = mask.tolist()
27
-
28
- return [
29
- {
30
- "label": "mock-segment",
31
- "mask": mask_list,
32
- "score": 0.99
33
- }
34
- ]