Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
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