David Hrachovy commited on
Commit
566a14d
1 Parent(s): eebd4e7

First commit

Browse files
Files changed (5) hide show
  1. README.md +4 -4
  2. app.py +13 -0
  3. battle.jpg +0 -0
  4. export.pkl +3 -0
  5. requirements.txt +1 -0
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Battletoads
3
- emoji: 🐨
4
- colorFrom: yellow
5
- colorTo: pink
6
  sdk: gradio
7
  sdk_version: 3.1.1
8
  app_file: app.py
 
1
  ---
2
+ title: Fastai
3
+ emoji: 📉
4
+ colorFrom: pink
5
+ colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 3.1.1
8
  app_file: app.py
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.pkl')
5
+
6
+ labels = learn.dls.vocab
7
+
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)),examples=["battle.jpg"],outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
battle.jpg ADDED
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56de775fe878dc4252f5a323fed60fa92a85efc77b805288207935af5cffd8df
3
+ size 87465003
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai