Antoine245 commited on
Commit
87fe2e2
·
1 Parent(s): dfec65b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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, labels):
8
  classifier = pipeline(task="image-classification")
9
- inputs = classifier(image)
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="label",
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)