Spaces:
Sleeping
Sleeping
Commit
·
e2cd426
1
Parent(s):
5b925b8
use image model
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
learn = load_learner('cat_or_dog.pkl')
|
|
|
4 |
|
5 |
+
def predict(image):
|
6 |
+
img = PILImage.create(image)
|
7 |
+
pred,pred_idx,probs = learn.predict(img)
|
8 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
9 |
+
|
10 |
+
gr.Interface(
|
11 |
+
fn=predict,
|
12 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
13 |
+
outputs=gr.outputs.Label(num_top_classes=3)
|
14 |
+
).launch(share=True)
|
15 |
|
16 |
demo.launch()
|