JaxHax commited on
Commit
831515a
·
1 Parent(s): 73098bc

added examples and project code

Browse files
Files changed (4) hide show
  1. app.py +17 -0
  2. mega.jpg +0 -0
  3. nano.jpg +0 -0
  4. uno.jpg +0 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ from huggingface_hub import push_to_hub_fastai
4
+ repo_id = "JaxHax/ArduinoClassifier"
5
+ learn = load_learner('model.pkl')
6
+ push_to_hub_fastai(learner=learn, repo_id=repo_id)
7
+ catagories = ('Mega', 'Nano', 'Uno')
8
+ def classify_image(img):
9
+ pred,idx,probs = learn.predict(img)
10
+ return dict(zip(catagories, map(float,probs)))
11
+
12
+ image = gr.inputs.Image(shape=(192,192))
13
+ label = gr.outputs.Label()
14
+ examples = ['uno.jpg', 'nano.jpg', 'mega.jpg']
15
+
16
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
17
+ intf.launch(inline=False)
mega.jpg ADDED
nano.jpg ADDED
uno.jpg ADDED