Jerry75AI commited on
Commit
cc2f78d
·
verified ·
1 Parent(s): 802c1db

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,7 +4,7 @@ from typing import Dict
4
  import numpy as np
5
  import tensorflow as tf
6
  from PIL import Image
7
- from bustapi import BustAPI, Request, Response
8
 
9
  LABELS = [
10
  "battery", # 电池
@@ -93,9 +93,9 @@ def predict(image):
93
  app = BustAPI()
94
 
95
  @app.post("/predict")
96
- async def predict_api(req: Request):
97
  # 读取 POST 二进制流
98
- img_bytes = await req.body()
99
  # 转 PIL Image
100
  image = Image.open(io.BytesIO(img_bytes)).convert("RGB")
101
  # 推理
 
4
  import numpy as np
5
  import tensorflow as tf
6
  from PIL import Image
7
+ from bustapi import BustAPI, request, Response
8
 
9
  LABELS = [
10
  "battery", # 电池
 
93
  app = BustAPI()
94
 
95
  @app.post("/predict")
96
+ async def predict_api():
97
  # 读取 POST 二进制流
98
+ img_bytes = await request.body()
99
  # 转 PIL Image
100
  image = Image.open(io.BytesIO(img_bytes)).convert("RGB")
101
  # 推理