Spaces:
Runtime error
Runtime error
Stefan Langenbach
commited on
Commit
·
f27c131
1
Parent(s):
382c697
Add app
Browse files- .gitattributes +1 -0
- app.py +24 -0
- chemical.jpg +3 -0
- chemical.pkl +3 -0
- power.jpg +3 -0
.gitattributes
CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import * # noqa: ruff[F403]
|
3 |
+
|
4 |
+
learner = load_learner("chemical.pkl")
|
5 |
+
|
6 |
+
|
7 |
+
def classify(img):
|
8 |
+
pred, idx, probs = learner.predict(img)
|
9 |
+
|
10 |
+
return dict(zip(("chemical plant", "power plant"), map(float, probs)))
|
11 |
+
|
12 |
+
|
13 |
+
image = gr.inputs.Image(
|
14 |
+
label="Upload image of chemical or power plant", type="filepath", shape=(192, 192)
|
15 |
+
)
|
16 |
+
label = gr.outputs.Label()
|
17 |
+
examples = ["chemical.jpg", "power.jpg"]
|
18 |
+
|
19 |
+
gr.Interface(
|
20 |
+
classify,
|
21 |
+
inputs=image,
|
22 |
+
outputs=label,
|
23 |
+
title="Chemical plant? Or Not?",
|
24 |
+
)
|
chemical.jpg
ADDED
Git LFS Details
|
chemical.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae2613382e53a8e95c19f4d8f8024ba92346af16afcfe441a622285dc071ec8d
|
3 |
+
size 46971770
|
power.jpg
ADDED
Git LFS Details
|