MCPcopy Index your code
hub / github.com/pythonstock/stock / post

Method post

backend/web/minstServingHandler.py:55–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53# 获得股票数据内容。
54class GetPrediction2DataHandler(webBase.BaseHandler):
55 def post(self):
56 # 获得分页参数。
57 imgStr = self.get_argument("txt", default="", strip=False)
58 # imgStr.replace(" ", "+")
59 imgStr = base64.b64decode(imgStr)
60 print("imgStr:", type(imgStr))
61 image = Image.open(io.StringIO(imgStr))
62 image.thumbnail((28, 28), Image.ANTIALIAS)
63 image = image.convert('L')
64 image = ImageOps.invert(image)
65 image.save(work_dir + "/web-tmp.bmp", format="BMP") #保存看看,是否
66 #print(image)
67 # img_url = self.get_argument("img_url", default=0, strip=False)
68 # print(img_url)
69 server = "0.0.0.0:8500"
70 prediction = do_inference(server, image)
71 print('######### prediction : ', prediction)
72 self.write(json.dumps(prediction))
73
74
75

Callers

nothing calls this directly

Calls 4

do_inferenceFunction · 0.85
openMethod · 0.80
invertMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected