Spaces:
Sleeping
Sleeping
Commit
·
87fe2e2
1
Parent(s):
dfec65b
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,9 @@ from transformers import pipeline
|
|
4 |
|
5 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
6 |
|
7 |
-
def predict(image
|
8 |
classifier = pipeline(task="image-classification")
|
9 |
-
|
10 |
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
|
11 |
return preds
|
12 |
|
@@ -20,7 +20,7 @@ gr.Interface(
|
|
20 |
# gr.inputs.Textbox(lines=1, label="Comma separated candidate labels", placeholder="Enter labels separated by ', '",)
|
21 |
],
|
22 |
theme="grass",
|
23 |
-
outputs=
|
24 |
title="Comparateur d'image",
|
25 |
description=description
|
26 |
-
).launch()
|
|
|
4 |
|
5 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
6 |
|
7 |
+
def predict(image):
|
8 |
classifier = pipeline(task="image-classification")
|
9 |
+
preds = classifier(image)
|
10 |
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
|
11 |
return preds
|
12 |
|
|
|
20 |
# gr.inputs.Textbox(lines=1, label="Comma separated candidate labels", placeholder="Enter labels separated by ', '",)
|
21 |
],
|
22 |
theme="grass",
|
23 |
+
outputs=gr.Textbox(),
|
24 |
title="Comparateur d'image",
|
25 |
description=description
|
26 |
+
).launch(debug=True)
|