Spaces:
Sleeping
Sleeping
Commit
·
ae6ea44
1
Parent(s):
7c7798d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#/export
|
2 |
+
learn=load_learner('model.pkl')
|
3 |
+
categories=('Dog','Cat')
|
4 |
+
def classify_image(img):
|
5 |
+
pred,ind,probs=learn.predict(img)
|
6 |
+
return dict(zip(categories,map(float,probs)))
|
7 |
+
# !pip install gradio
|
8 |
+
import gradio as gr
|
9 |
+
image=gr.inputs.Image(shape=(192,192))
|
10 |
+
label=gr.outputs.Label()
|
11 |
+
|
12 |
+
def greet(name): return f"hello {name}"
|
13 |
+
|
14 |
+
gr.Interface(fn=classify_image,inputs=image,outputs=label).launch()
|