File size: 649 Bytes
72c742e
 
 
 
 
 
 
 
 
 
 
6f95970
62ec921
72c742e
 
 
 
 
 
 
 
 
 
62ec921
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

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
learn = load_learner('model.pkl')
def is_cat(x): return x[0].isupper()
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)