Spaces:
Sleeping
Sleeping
Update app.py.py
Browse files
app.py.py
CHANGED
@@ -6,17 +6,13 @@ Automatically generated by Colaboratory.
|
|
6 |
Original file is located at
|
7 |
https://colab.research.google.com/drive/13X2E9v7GxryXyT39R5CzxrNwxfA6KMFJ
|
8 |
"""
|
9 |
-
|
10 |
-
!pip install gradio
|
11 |
-
|
12 |
import gradio as gr
|
13 |
from PIL import Image
|
14 |
from timeit import default_timer as timer
|
15 |
from tensorflow import keras
|
16 |
import numpy as np
|
17 |
|
18 |
-
MODEL = keras.models.load_model(
|
19 |
-
"convnet_from_scratch_with_augmentation.keras")
|
20 |
|
21 |
def predict(img):
|
22 |
|
@@ -41,6 +37,7 @@ def predict(img):
|
|
41 |
predict('/content/cat.1505.jpg')
|
42 |
|
43 |
# Create title, description and article strings
|
|
|
44 |
title = "Classification Demo"
|
45 |
description = "Cat/Dog classification Tensorflow model with Augmentted small dataset"
|
46 |
|
@@ -49,6 +46,7 @@ demo = gr.Interface(fn=predict, # mapping function from input to output
|
|
49 |
inputs=gr.Image(type='filepath'), # what are the inputs?
|
50 |
outputs=[gr.Label(label="Predictions"), # what are the outputs?
|
51 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
|
|
52 |
title=title,
|
53 |
description=description,)
|
54 |
|
@@ -56,15 +54,3 @@ demo = gr.Interface(fn=predict, # mapping function from input to output
|
|
56 |
demo.launch(debug=False, # print errors locally?
|
57 |
share=True) # generate a publically shareable URL?
|
58 |
|
59 |
-
pip install tensorflow
|
60 |
-
|
61 |
-
import PIL
|
62 |
-
|
63 |
-
import tensorflow as tf
|
64 |
-
|
65 |
-
import timeit
|
66 |
-
|
67 |
-
print(gr.__version__)
|
68 |
-
print(np.__version__)
|
69 |
-
print(tf.__version__)
|
70 |
-
print(PIL.__version__)
|
|
|
6 |
Original file is located at
|
7 |
https://colab.research.google.com/drive/13X2E9v7GxryXyT39R5CzxrNwxfA6KMFJ
|
8 |
"""
|
|
|
|
|
|
|
9 |
import gradio as gr
|
10 |
from PIL import Image
|
11 |
from timeit import default_timer as timer
|
12 |
from tensorflow import keras
|
13 |
import numpy as np
|
14 |
|
15 |
+
MODEL = keras.models.load_model("convnet_from_scratch_with_augmentation.keras")
|
|
|
16 |
|
17 |
def predict(img):
|
18 |
|
|
|
37 |
predict('/content/cat.1505.jpg')
|
38 |
|
39 |
# Create title, description and article strings
|
40 |
+
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
41 |
title = "Classification Demo"
|
42 |
description = "Cat/Dog classification Tensorflow model with Augmentted small dataset"
|
43 |
|
|
|
46 |
inputs=gr.Image(type='filepath'), # what are the inputs?
|
47 |
outputs=[gr.Label(label="Predictions"), # what are the outputs?
|
48 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
49 |
+
examples=example_list,
|
50 |
title=title,
|
51 |
description=description,)
|
52 |
|
|
|
54 |
demo.launch(debug=False, # print errors locally?
|
55 |
share=True) # generate a publically shareable URL?
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|