-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
executable file
·115 lines (97 loc) · 3.09 KB
/
model.py
File metadata and controls
executable file
·115 lines (97 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from __future__ import annotations
class GetProductRes:
def __init__(self, productIdx, productName, productPrice, productDescrip, productUrl, productImgs):
self.productIdx = productIdx
self.productName = productName
self.productPrice = productPrice
self.productDescrip = productDescrip
self.productUrl = productUrl
self.productImgs = productImgs
def serialize(self):
return {
'productIdx': self.productIdx,
'productName': self.productName,
'productPrice': self.productPrice,
'productDescrip': self.productDescrip,
'productUrl': self.productUrl,
'productImgs': self.productImgs
}
class PostImageRes:
def __init__(self, imageUuid, filePath):
self.imageUuid = imageUuid
self.filePath = filePath
def serialize(self):
return {
'imageUuid': self.imageUuid,
'filePath': self.filePath
}
'''
"label": "style_name1",
"probability": 0.8
'''
class Style:
def __init__(self, label, probability):
self.label = label
self.probability = probability
def serialize(self):
return {
'label': self.label,
'probability': self.probability
}
'''
"idx": 1,
"img_path": "http://qwer.asdf1.jpg"}
'''
class Detect_furniture:
def __init__(self, idx, img_path):
self.idx = idx
self.img_path = img_path
def serialize(self):
return {
'idx': self.idx,
'img_path': self.img_path
}
'''
"furniture_idx": 123,
"name": "가구 이름",
"price": 12345,
"image": "http://qwer.asdf",
"description": "가구 설명",
"url": "http://naver.com",
"ar_path": "http://ar.asdf"
'''
class Recommend_furniture:
def __init__(self, furniture_idx, name, price, image, description, url, ar_path):
self.furniture_idx = furniture_idx
self.name = name
self.price = price
self.image = image
self.description = description
self.url = url
self.ar_path = ar_path
def serialize(self):
return {
'furniture_idx': self.furniture_idx,
'name': self.name,
'price': self.price,
'image': self.image,
'description': self.description,
'url': self.url,
'ar_path': self.ar_path
}
'''
형태 : style(list<Style>), detect(list<Detect_furniture>)
recommend_list(list<Recommend_furniture>), recommend_furniture(Recommend_furniture)
'''
class GetImageRes():
def __init__(self, style: list[Style], detect: list[Detect_furniture], recommend_list: list[Recommend_furniture]):
self.style = style
self.detect = detect
self.recommend_list = recommend_list
#list(map(lambda x:x*x, range(1,6)))
def serialize(self):
return {
'style': list(map(lambda x: x.serialize() , self.style)),
'detect': list(map(lambda x: x.serialize() , self.detect)),
'recommend_list': list(map(lambda x: x.serialize() , self.recommend_list)),
}