changes
Browse files
app.py
CHANGED
@@ -1,7 +1,15 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
from fastcore import *
|
4 |
|
5 |
+
learn = load_learner('kitten.pkl')
|
|
|
6 |
|
7 |
+
classes = learn.dls.vocab
|
8 |
+
|
9 |
+
def classify_images(img):
|
10 |
+
img = PILimage.create(img)
|
11 |
+
pred,idx,prob = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
iface = gr.Interface(fn=classify_images, inputs=gr.interface.Image(shape=(512, 512)), outputs=gr.interface.Label())
|
15 |
+
iface.launch()
|