Spaces:
Sleeping
Sleeping
feat(app): init kaprao classifier app
Browse files- app.py +23 -0
- horapa-vs-kaprao-resnet34.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import load_learner, PILImage
|
3 |
+
|
4 |
+
learn = load_learner("horapa-vs-kaprao-resnet34.pkl")
|
5 |
+
labels = learn.dls.vocab
|
6 |
+
|
7 |
+
def predict(img):
|
8 |
+
"""
|
9 |
+
Prediction APIs.
|
10 |
+
"""
|
11 |
+
_, _, probs = learn.predict(PILImage.create(img))
|
12 |
+
|
13 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
14 |
+
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=predict,
|
18 |
+
inputs=gr.Image(),
|
19 |
+
outputs=gr.Label(num_top_classes=2),
|
20 |
+
title="Horapa VS Kaprao",
|
21 |
+
description="Kaprao classifier fined tuned on Resnet34 with Horapa and Kaprao samples from the internet. Its task is to recognize Kaprao so that you can use it to identify this ingredient correctly and cook your favourite menu with joy!"
|
22 |
+
)
|
23 |
+
demo.launch()
|
horapa-vs-kaprao-resnet34.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6066fbbafd91edd42eeda9b99fdc8b28ebc522fd9f7b8b18d497c709c7d00d59
|
3 |
+
size 87491242
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai~=2.7.15
|