JaxHax commited on
Commit
1bd06b6
1 Parent(s): eed6cf4

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. app.py +17 -4
  2. mega.jpg +0 -0
  3. model.pkl +3 -0
  4. nano.jpg +0 -0
  5. uno.jpg +0 -0
app.py CHANGED
@@ -1,7 +1,20 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ #from huggingface_hub import push_to_hub_fastai
4
+ from huggingface_hub import HfApi
5
+ api = HfApi()
6
+ repo_id = "JaxHax/ArduinoClassifier"
7
+ api.upload_folder(repo_id=repo_id, repo_type="space", folder_path="./")
8
+ learn = load_learner('model.pkl')
9
+ #push_to_hub_fastai(learner=learn, repo_id=repo_id)
10
+ catagories = ('Mega', 'Nano', 'Uno')
11
+ def classify_image(img):
12
+ pred,idx,probs = learn.predict(img)
13
+ return dict(zip(catagories, map(float,probs)))
14
 
15
+ image = gr.inputs.Image(shape=(192,192))
16
+ label = gr.outputs.Label()
17
+ examples = ['uno.jpg', 'nano.jpg', 'mega.jpg']
18
 
19
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
20
+ intf.launch(inline=False)
mega.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e96d85144350b085be4773382e96bec8050ab6d1784c66051b9156167636f2a2
3
+ size 46968253
nano.jpg ADDED
uno.jpg ADDED