Spaces:
Runtime error
Runtime error
Download app.py from napoleonthethird/newtest: direct link, hf CLI and curl.
- Browser
- Download file 460 Bytes
-
https://huggingface.co/spaces/napoleonthethird/newtest/resolve/main/app.py
- Command line
-
hf download hf://spaces/napoleonthethird/newtest/app.py
-
curl -L -o app.py https://huggingface.co/spaces/napoleonthethird/newtest/resolve/main/app.py
460 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner('gen_face_resnet_model.pkl') | |
| categories = ('notreal', 'real') | |
| def classify_image(img): | |
| pred,idx, probs = learn.predict(img) | |
| return (dict(zip(categories, map(float, probs)))) | |
| image = gr.Image(width=192, height=192) | |
| label = gr.Label() | |
| examples = ['person.jpg', 'ailo.jpg'] | |
| iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| iface.launch() |