sylwia malinowska
commited on
Commit
•
166e611
1
Parent(s):
8a127e0
foo
Browse files
app.py
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
|
4 |
-
|
5 |
-
return "Hello " + name + "!!"
|
6 |
|
|
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import all
|
3 |
|
4 |
|
5 |
+
learn = load_learner('cats.pkl')
|
|
|
6 |
|
7 |
+
categories = ('siamese', 'british shorthair', 'ragdoll',
|
8 |
+
'maine coon', 'european shorthair', 'persian')
|
9 |
|
10 |
+
|
11 |
+
def classify_image(img):
|
12 |
+
pred, idx, probs = learn.predict(img)
|
13 |
+
return dict(zip(categories, map(float, probs)))
|
14 |
+
|
15 |
+
|
16 |
+
image = gr.inputs.Image(shape=(192, 192))
|
17 |
+
label = gr.outputs.Label()
|
18 |
+
examples = ['siamese.jpg', 'british.jpg', 'european.jpg']
|
19 |
+
|
20 |
+
|
21 |
+
iface = gr.Interface(fn=classify_image, inputs=image,
|
22 |
+
outputs=label, examples=examples)
|
23 |
iface.launch()
|