Spaces:
Runtime error
Runtime error
Upload 12 files
Browse files- .gitattributes +1 -0
- app.py +32 -0
- assets/examples/butterfly.jpeg +0 -0
- assets/examples/bw.jpg +0 -0
- assets/examples/creature.jpg +0 -0
- assets/examples/gradio_demo.png +0 -0
- assets/examples/hillbefore.jpg +0 -0
- model/fingerprint.pb +3 -0
- model/keras_metadata.pb +3 -0
- model/saved_model.pb +3 -0
- model/variables/variables.data-00000-of-00001 +3 -0
- model/variables/variables.index +0 -0
- requirements.txt +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
import tensorflow as tf
|
4 |
+
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
model = tf.keras.models.load_model('model')
|
8 |
+
|
9 |
+
def predict_model(im):
|
10 |
+
im = tf.image.convert_image_dtype(im,tf.float32)
|
11 |
+
im = tf.expand_dims(im,axis=0)
|
12 |
+
|
13 |
+
pred = model.predict(im)
|
14 |
+
pred = pred[0]
|
15 |
+
pred = tf.clip_by_value(pred, 0.0, 1.0)
|
16 |
+
|
17 |
+
pred = Image.fromarray((np.array(pred) * 255).astype(np.uint8))
|
18 |
+
return pred
|
19 |
+
|
20 |
+
inimage = gr.Image(shape=(None,None))
|
21 |
+
inimage.style(width=512,height=512)
|
22 |
+
|
23 |
+
outimage = gr.Image(shape=(None,None))
|
24 |
+
outimage.style(width=512,height=512)
|
25 |
+
|
26 |
+
app = gr.Interface(fn=predict_model, inputs=inimage, outputs=outimage,examples=['./assets/examples/creature.jpg',
|
27 |
+
"./assets/examples/butterfly.jpeg",
|
28 |
+
"./assets/examples/bw.jpg",
|
29 |
+
"./assets/examples/hillbefore.jpg"])
|
30 |
+
|
31 |
+
app.launch()
|
32 |
+
|
assets/examples/butterfly.jpeg
ADDED
assets/examples/bw.jpg
ADDED
assets/examples/creature.jpg
ADDED
assets/examples/gradio_demo.png
ADDED
assets/examples/hillbefore.jpg
ADDED
model/fingerprint.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a59b12b5fe2f4327845a6d569e8dde85f80cf28406c8aa45462b0ecfb2abe08e
|
3 |
+
size 55
|
model/keras_metadata.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:34558f9cde3fdd1181c4d8d960c8dee7b5d0e10c263485b326fcb8d927c900d0
|
3 |
+
size 192273
|
model/saved_model.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7e460ef7b97a80f1d0722c703412228789a6658c02f47d03ceea8fcfcb4faeb4
|
3 |
+
size 2342347
|
model/variables/variables.data-00000-of-00001
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b6f47e06f7007e5b9c6bc764319219fd77eb960487a2d8aec888da380b2faa0b
|
3 |
+
size 18278883
|
model/variables/variables.index
ADDED
Binary file (18.9 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
numpy
|
3 |
+
tensorflow-cpu
|