Spaces:
Runtime error
Runtime error
arihantvyavhare
commited on
Commit
•
e551c67
1
Parent(s):
13537a7
gradio web app ready
Browse files- app.ipynb +0 -0
- app.py +16 -11
- converter_update.py +1 -1
- dell 20.jpg +3 -0
- dell inspiron.jpg +3 -0
- desktop pc on table.jpg +3 -0
app.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
app.py
CHANGED
@@ -1,27 +1,32 @@
|
|
1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
# Cell
|
6 |
from fastai.vision.all import *
|
7 |
import gradio as gr
|
8 |
|
9 |
def is_cat(x): return x[0].isupper()
|
10 |
|
11 |
-
# Cell
|
12 |
-
learn = load_learner('model.pkl')
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def classify_image(img):
|
18 |
pred,idx,probs = learn.predict(img)
|
19 |
return dict(zip(categories, map(float,probs)))
|
20 |
|
21 |
-
#
|
22 |
image = gr.inputs.Image(shape=(192, 192))
|
23 |
label = gr.outputs.Label()
|
24 |
-
examples = ['
|
25 |
|
26 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
27 |
-
intf.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
+
# %%
|
|
|
|
|
3 |
from fastai.vision.all import *
|
4 |
import gradio as gr
|
5 |
|
6 |
def is_cat(x): return x[0].isupper()
|
7 |
|
|
|
|
|
8 |
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
# %%
|
14 |
+
learn = load_learner('export.pkl')
|
15 |
+
|
16 |
+
# %%
|
17 |
+
categories = ('desktop pc','laptop','mobile phone')
|
18 |
|
19 |
def classify_image(img):
|
20 |
pred,idx,probs = learn.predict(img)
|
21 |
return dict(zip(categories, map(float,probs)))
|
22 |
|
23 |
+
# %%
|
24 |
image = gr.inputs.Image(shape=(192, 192))
|
25 |
label = gr.outputs.Label()
|
26 |
+
examples = ['dell 20.jpg', 'dell inspiron.jpg', 'desktop pc on table.jpg']
|
27 |
|
28 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
29 |
+
intf.launch(inline=False)
|
30 |
+
|
31 |
+
# %%
|
32 |
+
## end -
|
converter_update.py
CHANGED
@@ -15,7 +15,7 @@ py_file = open(f"{filename}.py", "w+")
|
|
15 |
|
16 |
for cell in code['cells']:
|
17 |
if cell['cell_type'] == 'code':
|
18 |
-
if cell['source'] and "#| export" in cell['source'][0]:
|
19 |
py_file.write("# %%\n") #you can comment out this line
|
20 |
for line in cell['source'][1:]:
|
21 |
py_file.write(line)
|
|
|
15 |
|
16 |
for cell in code['cells']:
|
17 |
if cell['cell_type'] == 'code':
|
18 |
+
if cell['source'] and (("#| export" in cell['source'][0]) or("#|export" in cell['source'][0]) ):
|
19 |
py_file.write("# %%\n") #you can comment out this line
|
20 |
for line in cell['source'][1:]:
|
21 |
py_file.write(line)
|
dell 20.jpg
ADDED
Git LFS Details
|
dell inspiron.jpg
ADDED
Git LFS Details
|
desktop pc on table.jpg
ADDED
Git LFS Details
|