Spaces:
Sleeping
Sleeping
Commit
·
596e564
1
Parent(s):
0c5d83d
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,8 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
7 |
def predict(image):
|
8 |
classifier = pipeline(task="image-classification")
|
9 |
preds = classifier(image)
|
10 |
-
|
11 |
-
label = gr.Label(output_format="json", default_value=
|
12 |
return label
|
13 |
|
14 |
description = """
|
|
|
7 |
def predict(image):
|
8 |
classifier = pipeline(task="image-classification")
|
9 |
preds = classifier(image)
|
10 |
+
prediction_json = json.dumps({"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds)
|
11 |
+
label = gr.Label(output_format="json", default_value=prediction_json)
|
12 |
return label
|
13 |
|
14 |
description = """
|