Download example.py from phungthanhtu/rafdb-fer-supervised-4000: direct link, hf CLI and curl.
- Browser
- Download file 691 Bytes
-
https://huggingface.co/phungthanhtu/rafdb-fer-supervised-4000/resolve/main/example.py
- Command line
-
hf download hf://phungthanhtu/rafdb-fer-supervised-4000/example.py
-
curl -L -o example.py https://huggingface.co/phungthanhtu/rafdb-fer-supervised-4000/resolve/main/example.py
691 Bytes
| """Predict the expression of one or more images with a published model. | |
| python example.py ../../face.jpg | |
| python example.py a.jpg b.jpg --repo phungthanhtu/rafdb-fer-adacm-4000 | |
| """ | |
| import argparse | |
| import model | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("images", nargs="+") | |
| ap.add_argument("--repo", default="phungthanhtu/rafdb-fer-supervised-4000") | |
| args = ap.parse_args() | |
| net = model.load(args.repo) | |
| print(f"{args.repo}") | |
| for path in args.images: | |
| print(path) | |
| for name, prob in model.predict(net, path): | |
| print(f" {name:<10s} {prob:.3f}") | |
| if __name__ == "__main__": | |
| main() | |