Spaces:
Sleeping
Sleeping
| import numpy as np # linear algebra | |
| import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) | |
| import os | |
| for dirname, _, filenames in os.walk('/kaggle/input'): | |
| for filename in filenames: | |
| print(os.path.join(dirname, filename)) | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| share = True | |
| def is_cat(x): return x[0].isupper() | |
| learn = load_learner('model.pkl') | |
| categories = ('Dog', 'Cat') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = "image" | |
| label = "label" | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) | |
| intf.launch(inline=False, share = True) |