Spaces:
Running
Running
Clement Vachet
commited on
Commit
·
71bec2b
1
Parent(s):
f9066a9
style: comment out print outputs
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def retrieve_api():
|
|
30 |
|
31 |
#@spaces.GPU
|
32 |
def detect(image_path, model_id, threshold):
|
33 |
-
print("\n
|
34 |
print("\t ML model:", list_models[model_id])
|
35 |
|
36 |
with open(image_path, 'rb') as image_file:
|
@@ -41,7 +41,6 @@ def detect(image_path, model_id, threshold):
|
|
41 |
API_endpoint = AWS_API + "/2015-03-31/functions/function/invocations"
|
42 |
else:
|
43 |
API_endpoint = AWS_API + "/dev/detect"
|
44 |
-
print("\t API_Endpoint: ", API_endpoint)
|
45 |
|
46 |
# Encode the image data in base64
|
47 |
encoded_image = base64.b64encode(image_bytes).decode('utf-8')
|
@@ -62,10 +61,7 @@ def detect(image_path, model_id, threshold):
|
|
62 |
# Process the response
|
63 |
response_json = response.json()
|
64 |
print('\t API response', response_json)
|
65 |
-
print('\t API response - type', type(response_json))
|
66 |
prediction_dict = json.loads(response_json["body"])
|
67 |
-
print('\t API body prediction_dict', prediction_dict)
|
68 |
-
print('\t API body prediction_dict - type', type(prediction_dict))
|
69 |
else:
|
70 |
prediction_dict = {"Error": response.status_code}
|
71 |
gr.Error(f"\t API Error: {response.status_code}")
|
|
|
30 |
|
31 |
#@spaces.GPU
|
32 |
def detect(image_path, model_id, threshold):
|
33 |
+
print("\n UI - Object detection...")
|
34 |
print("\t ML model:", list_models[model_id])
|
35 |
|
36 |
with open(image_path, 'rb') as image_file:
|
|
|
41 |
API_endpoint = AWS_API + "/2015-03-31/functions/function/invocations"
|
42 |
else:
|
43 |
API_endpoint = AWS_API + "/dev/detect"
|
|
|
44 |
|
45 |
# Encode the image data in base64
|
46 |
encoded_image = base64.b64encode(image_bytes).decode('utf-8')
|
|
|
61 |
# Process the response
|
62 |
response_json = response.json()
|
63 |
print('\t API response', response_json)
|
|
|
64 |
prediction_dict = json.loads(response_json["body"])
|
|
|
|
|
65 |
else:
|
66 |
prediction_dict = {"Error": response.status_code}
|
67 |
gr.Error(f"\t API Error: {response.status_code}")
|