Skip to content

Commit 97789b4

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in f9f13e9 according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/65a9ecdc-6af2-47b0-b765-02c9d9fd0b34/
1 parent f9f13e9 commit 97789b4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Flask_Apis/Image_recognition_from_File_format.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,18 @@ def predictface():
8989

9090
else:
9191
return jsonify({'similarity_percentage': 'Could not detect faces in both images.'})
92-
93-
@app.route('/face_recognize_from_Urls',methods=['POST'])
92+
93+
94+
@app.route('/face_recognize_from_Urls', methods=['POST'])
9495
def predictface():
95-
data=request.json
96-
url1=data['url1']
97-
# get URL of first image from form data
96+
data = request.json
97+
url1 = data['url1']
98+
# get URL of first image from form data
9899
url2 = data['url2']
99100

100101
# Read the first image from URL using requests library
101-
img1 = cv2.imdecode(np.frombuffer(requests.get(url1).content, np.uint8), cv2.IMREAD_COLOR)
102+
img1 = cv2.imdecode(np.frombuffer(requests.get(
103+
url1).content, np.uint8), cv2.IMREAD_COLOR)
102104

103105
# Download the second image from the URL
104106
with urllib.request.urlopen(url2) as url:
@@ -110,8 +112,10 @@ def predictface():
110112
gray_img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
111113

112114
# Detect faces in the images
113-
faces1 = face_cascade.detectMultiScale(gray_img1, scaleFactor=1.1, minNeighbors=5)
114-
faces2 = face_cascade.detectMultiScale(gray_img2, scaleFactor=1.1, minNeighbors=5)
115+
faces1 = face_cascade.detectMultiScale(
116+
gray_img1, scaleFactor=1.1, minNeighbors=5)
117+
faces2 = face_cascade.detectMultiScale(
118+
gray_img2, scaleFactor=1.1, minNeighbors=5)
115119

116120
# Compare only the first detected face in each image
117121
if len(faces1) > 0 and len(faces2) > 0:
@@ -135,7 +139,7 @@ def predictface():
135139
return jsonify({'similarity_percentage': similarity_percentage})
136140

137141
else:
138-
return jsonify({'similarity_percentage': 'Could not detect faces in both images.'})
142+
return jsonify({'similarity_percentage': 'Could not detect faces in both images.'})
139143

140144

141145
if __name__ == '__main__':

0 commit comments

Comments
 (0)