Spaces:
Runtime error
Runtime error
Juanchoalric
commited on
Commit
•
4507e1f
1
Parent(s):
830fc9f
deploy
Browse files- app.py +18 -0
- model_convnext_small_in22k_version_1.pkl +3 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('model_convnext_small_in22k_version_1.pkl')
|
5 |
+
categories = ("fire", "nofire")
|
6 |
+
|
7 |
+
def classify_image(img):
|
8 |
+
pred, idx, prob = learn.predict(img)
|
9 |
+
return dict(zip(categories, map(float, prob)))
|
10 |
+
|
11 |
+
img = gr.inputs.Image(shape=(250, 250))
|
12 |
+
label = gr.outputs.Label()
|
13 |
+
|
14 |
+
gr.Interface(
|
15 |
+
fn=classify_image,
|
16 |
+
inputs="image",
|
17 |
+
outputs="label",
|
18 |
+
interpretation='default').launch()
|
model_convnext_small_in22k_version_1.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd69c4abfc1cd139303e2f8a97c932ac5f7ad0108ae228c46bb2ca6c479beab3
|
3 |
+
size 201256745
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
timm==0.6.5
|
2 |
+
fastai==2.7.7
|
3 |
+
scikit-image==0.19.3
|