Spaces:
Sleeping
Sleeping
RaviRaj988
commited on
Commit
·
d0460d1
1
Parent(s):
fd77c15
inintial commit
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +6 -0
- app.ipynb +0 -0
- app.py +20 -0
- model.pkl +3 -0
.ipynb_checkpoints/app-checkpoint.ipynb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {},
|
4 |
+
"nbformat": 4,
|
5 |
+
"nbformat_minor": 5
|
6 |
+
}
|
app.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
import torch as t
|
4 |
+
|
5 |
+
t.cuda.is_available()
|
6 |
+
|
7 |
+
def is_cat(x): return x[0].isupper()
|
8 |
+
|
9 |
+
l=load_learner('model.pkl')
|
10 |
+
|
11 |
+
cat=('cat','dog')
|
12 |
+
def classify(img):
|
13 |
+
s,i,p=l.predict(img)
|
14 |
+
return dict(zip(cat,map(float,p)))
|
15 |
+
|
16 |
+
image=gr.inputs.Image(shape=(192,192))
|
17 |
+
label=gr.outputs.Label()
|
18 |
+
inf=gr.Interface(fn=classify,inputs=image,outputs=label)
|
19 |
+
inf.launch(inline=False)
|
20 |
+
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aac37d59ff48c175a1b0a8a28216010abdae521a091323a7edd08fb65d705694
|
3 |
+
size 47065323
|