Spaces:
Runtime error
Runtime error
Adding files for Deploying gradio app to Huggingface spaces
Browse files- app.py +25 -0
- lambo1.jpg +0 -0
- lamborghini_vs_mercedes_model.pkl +3 -0
- mercedes1.jpg +0 -0
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'interface', 'predict']
|
5 |
+
|
6 |
+
# %% app.ipynb 3
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% app.ipynb 4
|
11 |
+
learn = load_learner('lamborghini_vs_mercedes_model.pkl')
|
12 |
+
|
13 |
+
# %% app.ipynb 5
|
14 |
+
categories = ('lamborghini', 'mercedes')
|
15 |
+
|
16 |
+
def predict(img):
|
17 |
+
pred, idx, prob = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float, prob)))
|
19 |
+
|
20 |
+
# %% app.ipynb 7
|
21 |
+
image = gr.inputs.Image(shape=(192,192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
|
24 |
+
interface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=['lambo1.jpg', 'mercedes1.jpg'])
|
25 |
+
interface.launch(inline=False)
|
lambo1.jpg
ADDED
![]() |
lamborghini_vs_mercedes_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e4a96000b7bbf849199c085219e9b2e4fb52c7855b9e1f0c8fd1009f9207084f
|
3 |
+
size 87463535
|
mercedes1.jpg
ADDED
![]() |