Spaces:
Runtime error
Runtime error
Download app.py from ianlgrisham/type: direct link, hf CLI and curl.
- Browser
- Download file 565 Bytes
-
https://huggingface.co/spaces/ianlgrisham/type/resolve/main/app.py
- Command line
-
hf download hf://spaces/ianlgrisham/type/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ianlgrisham/type/resolve/main/app.py
565 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| import pathlib | |
| plt = platform.system() | |
| if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath | |
| learn = load_learner('935.pkl') | |
| categories = ('Contemporary', 'EthnicExotic', 'Floral', 'Foliage', 'Texture', 'Traditional', 'Transitional') | |
| def classify(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image(shape=(400,400)) | |
| label = gr.outputs.Label() | |
| intf = gr.Interface(fn=classify, inputs=image, outputs=label) | |
| intf.launch(inline=False) |