用kafka接收消息
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
wangjin0928 b2d1e472c6 签入版本 2 лет назад
..
README.md 签入版本 2 лет назад
example_request.py 签入版本 2 лет назад
restapi.py 签入版本 2 лет назад

README.md

Flask REST API

REST APIs are commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API created using Flask to expose the yolov5s model from PyTorch Hub.

Requirements

Flask is required. Install with:

$ pip install Flask

Run

After Flask installation run:

$ python3 restapi.py --port 5000

Then use curl to perform a request:

$ curl -X POST -F image=@zidane.jpg 'http://localhost:5000/v1/object-detection/yolov5s'`

The model inference results are returned:

[{'class': 0,
  'confidence': 0.8197850585,
  'name': 'person',
  'xmax': 1159.1403808594,
  'xmin': 750.912902832,
  'ymax': 711.2583007812,
  'ymin': 44.0350036621},
 {'class': 0,
  'confidence': 0.5667674541,
  'name': 'person',
  'xmax': 1065.5523681641,
  'xmin': 116.0448303223,
  'ymax': 713.8904418945,
  'ymin': 198.4603881836},
 {'class': 27,
  'confidence': 0.5661227107,
  'name': 'tie',
  'xmax': 516.7975463867,
  'xmin': 416.6880187988,
  'ymax': 717.0524902344,
  'ymin': 429.2020568848}]

An example python script to perform inference using requests is given in example_request.py