Spaces:
Runtime error
Runtime error
mcmullarkey
commited on
Commit
•
336c7cd
1
Parent(s):
81d0c6a
update with minimal interface
Browse files- .gitattributes +1 -0
- app.py +14 -4
- real_test_image.jpg +0 -0
- sd_test_image.jpg +0 -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 |
+
sd_or_not_model_timm.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
|
|
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("sd_or_not_model_timm.pkl")
|
|
|
5 |
|
6 |
+
categories = ("Photo", "Stable Diffusion Generated")
|
7 |
+
|
8 |
+
def classify_image(img):
|
9 |
+
pred,idx,probs = learn.predict()
|
10 |
+
return dict(zip(categories, map(float, probs)))
|
11 |
+
|
12 |
+
image = gr.inputs.Image(shape=(192,192))
|
13 |
+
label = gr.outputs.Label()
|
14 |
+
examples = ["real_test_image.jpg","sd_test_image.jpg"]
|
15 |
+
|
16 |
+
intf = gr.Interface(fn = classify_image, inputs = image, outputs = label, examples = examples)
|
17 |
+
intf.launch(inline = False)
|
real_test_image.jpg
ADDED
sd_test_image.jpg
ADDED