Antoine245 commited on
Commit
dfc2140
·
1 Parent(s): ad2a517

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,7 +8,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
 
13
  description = """
14
  """
@@ -16,9 +16,9 @@ description = """
16
  gr.Interface(
17
  fn=predict,
18
  inputs=[
19
- gr.components.Image(label="Image to classify", type="pil"),
20
  ],
21
- outputs="label",
22
  title="Comparateur d'image",
23
  description=description
24
  ).launch()
 
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 {"predictions": preds}
12
 
13
  description = """
14
  """
 
16
  gr.Interface(
17
  fn=predict,
18
  inputs=[
19
+ gr.inputs.Image(label="Image to classify", type="pil"),
20
  ],
21
+ outputs=gr.outputs.JSON(),
22
  title="Comparateur d'image",
23
  description=description
24
  ).launch()