utshox commited on
Commit
d78fd93
1 Parent(s): 352e7bd
.ipynb_checkpoints/Untitled-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
.ipynb_checkpoints/Untitled1-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
.ipynb_checkpoints/Untitled2-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
app.py CHANGED
@@ -1,7 +1,27 @@
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
+ __all__=['is_cat','learn','classify_image','categories','image','label','examples','intf']
2
+
3
+
4
+ from fastai.vision.all import*
5
  import gradio as gr
6
 
7
+ def is_cat(x): return x[0].isupper()
8
+
9
+ learn=load_learner('model.pkl')
10
+
11
+ categories=('dog','cat')
12
+
13
+ def classify_image(img):
14
+ pred,idx,probs=learn.predict(img)
15
+ return dict(zip(categories, map(float,probs)))
16
+
17
+ image=gr.inputs.Image(shape=(192,192))
18
+ label = gr.outputs.Label()
19
+ examples=['dog.jpg','cat.jpg','dunno.jpg']
20
+
21
+ intf=gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
22
+ intf.launch(inline=False)
23
+ # def greet(name):
24
+ # return "Hello " + name + "!!"
25
 
26
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
27
+ # iface.launch()
cat.jpg ADDED
dog.jpg ADDED
dunno.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c09d8f778f89c9eb588eefd9a5ba094eb163cd3ea708a4ea567a83e924f149f
3
+ size 47059947