Spaces:
Runtime error
Runtime error
final
Browse files- app.py +11 -4
- spiral_model.pkl +3 -0
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('spiral_model.pkl')
|
|
|
5 |
|
6 |
+
def classify_img(img):
|
7 |
+
pred,idx,probs = learn.predict(img)
|
8 |
+
return str(pred + ", probability: " + str(round(torch.max(probs).item(), 4)) )
|
9 |
+
|
10 |
+
image = gr.inputs.Image(shape=(400, 400))
|
11 |
+
label = gr.outputs.Label()
|
12 |
+
|
13 |
+
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label)
|
14 |
+
intf.launch(inline=False)
|
spiral_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2e544545d8997943f075024a14dba58bd5abcdb35dac4414bf14663730072fc8
|
3 |
+
size 87478028
|