Spaces:
Running
Running
Peter Organisciak
commited on
Commit
·
69b1c36
1
Parent(s):
8c532f5
Dealing with types
Browse files- gradio-ocsai-d.py +5 -2
gradio-ocsai-d.py
CHANGED
@@ -58,8 +58,11 @@ def get_predictions(img):
|
|
58 |
def classify_image(img_dict: dict):
|
59 |
# gradio passes a dictionary with background, composite, and layers
|
60 |
# the composite is what we want
|
61 |
-
img = img_dict['composite']
|
62 |
-
|
|
|
|
|
|
|
63 |
|
64 |
score_round = str(np.round(p['originality'], 2))
|
65 |
label = f"Percentile: {p['percentile']}; Normalized Score: {score_round}"
|
|
|
58 |
def classify_image(img_dict: dict):
|
59 |
# gradio passes a dictionary with background, composite, and layers
|
60 |
# the composite is what we want
|
61 |
+
img = img_dict['composite']
|
62 |
+
if img is None:
|
63 |
+
return None
|
64 |
+
|
65 |
+
p = get_predictions(img.convert('RGB'))
|
66 |
|
67 |
score_round = str(np.round(p['originality'], 2))
|
68 |
label = f"Percentile: {p['percentile']}; Normalized Score: {score_round}"
|