romain130492 commited on
Commit
fa654b9
1 Parent(s): 0eb3b6c
.ipynb_checkpoints/app-checkpoint.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
.ipynb_checkpoints/app2-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
app.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+
5
+ def is_cat(x): return x[0].isupper()
6
+
7
+
8
+ learn = load_learner('model.pkl')
9
+ categories = ('Dog', 'Cat')
10
+
11
+
12
+ def classify_image(img):
13
+ pred, idx, probs = learn.predict(img)
14
+ return dic(zip(categories, map(float, probs)))
15
+
16
+
17
+ image = gr.inputs.Image(shape=(192, 192))
18
+ label = gr.outputs.Label()
19
+ examples = ['dog.png', 'cat.png']
20
+
21
+ intf = gr.Interface(fn=classify_image, inputs=image,
22
+ outputs=label, examples=examples)
23
+ intf.launch(inline=False)
cat.png ADDED
dog.png ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38d2fa469893216bfb36304d7c13dbcd5a9f73ef137ac4b582aa1df704e263d9
3
+ size 47059947