Spaces:
Runtime error
Runtime error
test
Browse files- app.py +15 -2
- first_model.pkl +3 -0
- suiseicz.png +0 -0
- test.ipynb +0 -0
- tokocz.jpg +0 -0
app.py
CHANGED
|
@@ -1,9 +1,22 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
def greet(name):
|
| 5 |
return "Hello " + name + "!!"
|
| 6 |
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
|
| 4 |
|
| 5 |
def greet(name):
|
| 6 |
return "Hello " + name + "!!"
|
| 7 |
|
| 8 |
|
| 9 |
+
def classify_img(img):
|
| 10 |
+
categories = ["Suisei", "Toko"]
|
| 11 |
+
pred, idx, probs = learn.predict(img)
|
| 12 |
+
return dict(zip(categories, map(float, probs)))
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
learn = load_learner("first_model.pkl")
|
| 16 |
+
|
| 17 |
+
image = gr.inputs.Image(shape=(100, 100))
|
| 18 |
+
label = gr.outputs.Label()
|
| 19 |
+
examples = ["suiseicz.png", "tokocz.jpg"]
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(fn=classify_img, inputs=image, outputs=label)
|
| 22 |
+
iface.launch(inline=False)
|
first_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b3c2a33ce2e22d93d83ab6db4fb821ec9dc5f968d85953b32bfa4738714617a
|
| 3 |
+
size 46964193
|
suiseicz.png
ADDED
|
test.ipynb
ADDED
|
File without changes
|
tokocz.jpg
ADDED
|