Spaces:
Runtime error
Runtime error
wostrie2
commited on
Commit
•
f5b5d51
1
Parent(s):
ce9d43f
changes to app, 1 lizard photo
Browse files- app.py +24 -2
- lizard.jpg +0 -0
app.py
CHANGED
@@ -1,7 +1,29 @@
|
|
1 |
-
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
""" import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
+
iface.launch()
|
8 |
+
"""
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
from fastai.vision.all import *
|
13 |
+
import gradio as gr
|
14 |
+
|
15 |
+
learn = load_learner("model.pkl")
|
16 |
+
|
17 |
+
categories = ("Lizard", "Rocks")
|
18 |
+
|
19 |
+
def classify_image(img):
|
20 |
+
pred,idx,probs = learn.predict(img)
|
21 |
+
return dict(zip(categories, map(float,probs)))
|
22 |
+
|
23 |
+
image = gr.inputs.Image(shape=(192, 192))
|
24 |
+
label = gr.outputs.Label()
|
25 |
+
examples = ["lizard.jpg", "lizard_2.jpg", "rocks.jpg"]
|
26 |
+
|
27 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
28 |
+
intf.launch(inline=False)
|
29 |
+
|
lizard.jpg
ADDED