ewgen82 commited on
Commit
605dd43
1 Parent(s): aa799f6

Draft that expected to work

Browse files
Files changed (3) hide show
  1. Spinosaurus.jpg +0 -0
  2. app.py +15 -3
  3. export.pkl +3 -0
Spinosaurus.jpg ADDED
app.py CHANGED
@@ -1,13 +1,25 @@
 
1
  from fastai.vision.all import *
 
2
 
3
  learn = load_learner('export.pkl')
 
4
  labels = learn.dls.vocab
5
  def predict(img):
6
  img = PILImage.create(img)
7
  pred,pred_idx,probs = learn.predict(img)
8
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
9
 
10
- import gradio as gr
11
- gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)),
12
- outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
 
 
 
13
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  from fastai.vision.all import *
3
+ import skimage
4
 
5
  learn = load_learner('export.pkl')
6
+
7
  labels = learn.dls.vocab
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
+ title = "Dinosaur Classifier"
14
+ description = "A dinosour classifier is just dummy model trained on DuckDuckGo search images with fastai. Created to learn more about Gradio and HuggingFace Spaces."
15
+ article="<p style='text-align: center'>Dino guesser</p>"
16
+ examples = ['Spinosaurus.jpg']
17
+ interpretation='default'
18
+ enable_queue=True
19
 
20
+ gr.Interface(fn=predict,
21
+ inputs=gr.inputs.Image(shape=(512, 512)),
22
+ outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,
23
+ article=article,examples=examples,
24
+ interpretation=interpretation,
25
+ enable_queue=enable_queue).launch()
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84f530b49c2ab48a6a4185d44785bf8f9f1014429880fae85ddedb960d8420b9
3
+ size 102931084