Skip to content

Commit 6faeeac

Browse files
committed
Update api.py
1 parent 538faf9 commit 6faeeac

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/api/api.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def mask_decode_to_image(encoding):
110110
try:
111111
# response = requests.get('http://0.0.0.0:8080/sam/sam-model')
112112
# print(f'\nsam/sam-model: {response.text}\n')
113-
if "Success" in requests.get('http://0.0.0.0:8080/sam/heartbeat'):
113+
response = requests.get('http://0.0.0.0:8080/sam/heartbeat')
114+
print(f'\nsam/sam-model: {response.text}\n')
115+
if "Success" in response.text:
114116
# print(f'\nsam/heartbeat: {response.text}\n')
115117
image = encode_pil_to_base64(image)
116118
response = requests.post('http://0.0.0.0:8080/sam/heartbeat', json={
@@ -120,12 +122,13 @@ def mask_decode_to_image(encoding):
120122
})
121123
if "masked_image" in response:
122124
image = decode_base64_to_image(response.masked_image)
125+
print(f'SAM successfully dilated mask by 16.')
123126

124127
else:
125-
print(f'!!!! Error: sam did not return a masked_image!')
128+
print(f'!!!! Error: SAM did not return a masked_image!')
126129
raise HTTPException(status_code=500, detail="Error: sam did not return a masked_image!")
127130
else:
128-
print(f'!!!! Error: sam heartbeat lost!')
131+
print(f'!!!! Error: SAM heartbeat lost!')
129132
except Exception as err:
130133
pass
131134

0 commit comments

Comments
 (0)