Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
098b0026
Unverified
Commit
098b0026
authored
Apr 11, 2022
by
Patrick von Platen
Committed by
GitHub
Apr 11, 2022
Browse files
[Doctests] Correct task summary (#16644)
parent
6ef7186b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
docs/source/en/task_summary.mdx
docs/source/en/task_summary.mdx
+7
-8
No files found.
docs/source/en/task_summary.mdx
View file @
098b0026
...
@@ -1090,16 +1090,15 @@ The following examples demonstrate how to use a [`pipeline`] and a model and tok
...
@@ -1090,16 +1090,15 @@ The following examples demonstrate how to use a [`pipeline`] and a model and tok
>>> from transformers import pipeline
>>> from transformers import pipeline
>>> vision_classifier = pipeline(task="image-classification")
>>> vision_classifier = pipeline(task="image-classification")
>>> vision_classifier(
>>>
result =
vision_classifier(
... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
... )
... )
[{'
label
': '
lynx
,
catamount
', '
score
': 0.4403027892112732},
>>> print("\n".join([f"Class {d['
label
']} with score {round(d['
score
'], 4)}" for d in result]))
{'
label
': '
cougar
,
puma
,
catamount
,
mountain
lion
,
painter
,
panther
,
Felis
concolor
',
Class lynx, catamount with score 0.4335
'
score
': 0.03433405980467796},
Class cougar, puma, catamount, mountain lion, painter, panther, Felis concolor with score 0.0348
{'
label
': '
snow
leopard
,
ounce
,
Panthera
uncia
',
Class snow leopard, ounce, Panthera uncia with score 0.0324
'
score
': 0.032148055732250214},
Class Egyptian cat with score 0.0239
{'
label
': '
Egyptian
cat
', '
score
': 0.02353910356760025},
Class tiger cat with score 0.0229
{'
label
': '
tiger
cat
', '
score
': 0.023034192621707916}]
```
```
The general process for using a model and feature extractor for image classification is:
The general process for using a model and feature extractor for image classification is:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment