Update
Browse files
app.py
CHANGED
|
@@ -5,3 +5,24 @@ def greet(name):
|
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
| 8 |
+
|
| 9 |
+
inf = load_learner('export.pkl')
|
| 10 |
+
|
| 11 |
+
#categories = ('Cat', 'Cheetah', 'Other', 'Leopard', 'Lion', 'Snow Leopard', 'Tiger')
|
| 12 |
+
|
| 13 |
+
def classify_img(img):
|
| 14 |
+
pred, idx, probs = inf.predict(img)
|
| 15 |
+
return dict(zip(categories,map(float,probs)))
|
| 16 |
+
|
| 17 |
+
#|export
|
| 18 |
+
|
| 19 |
+
#This creates the gradio interface
|
| 20 |
+
|
| 21 |
+
image = gr.Image(shape=(192,192))
|
| 22 |
+
label = gr.outputs.Label()
|
| 23 |
+
|
| 24 |
+
#examples = ['cheetah.jpg','leopard.jpg','img.jpg']
|
| 25 |
+
|
| 26 |
+
#intf = gr.Interface(fn = classify_img, inputs=image,outputs=label,examples = examples)
|
| 27 |
+
|
| 28 |
+
intf.launch()
|