(self)
| 53 | # 获得股票数据内容。 |
| 54 | class 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 |
nothing calls this directly
no test coverage detected