Context manager open(file) as f fixes (#7289)
* Flask context manager `open()` fix * Additional read context manager fixes
This commit is contained in:
1 parent
2181ef371e
commit
5f97001ed4
5 files changed
+17
-6
No files matched your search
@@ -1,12 +1,18 @@
|
||||
"""Perform test request"""
|
||||
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||
"""
|
||||
Perform test request
|
||||
"""
|
||||
|
||||
import pprint
|
||||
|
||||
import requests
|
||||
|
||||
DETECTION_URL = "http://localhost:5000/v1/object-detection/yolov5s"
|
||||
TEST_IMAGE = "zidane.jpg"
|
||||
IMAGE = "zidane.jpg"
|
||||
|
||||
image_data = open(TEST_IMAGE, "rb").read()
|
||||
# Read image
|
||||
with open(IMAGE, "rb") as f:
|
||||
image_data = f.read()
|
||||
|
||||
response = requests.post(DETECTION_URL, files={"image": image_data}).json()
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||
"""
|
||||
Run a Flask REST API exposing a YOLOv5s model
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import io
|
||||
|
||||
|
||||
Reference in new issue
Block a user