Spaces:
Runtime error
Runtime error
more example pics
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ url = 'https://drive.google.com/uc?id=1Ep2YWU4M-yVkF7AFP3aD1sVhuriIDzFe'
|
|
22 |
path_model = "./model_state_restnet_leeds_butterfly.pth"
|
23 |
gdown.download(url, path_model, quiet=False)
|
24 |
|
|
|
25 |
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Red_postman_butterfly_%28Heliconius_erato%29.jpg/1599px-Red_postman_butterfly_%28Heliconius_erato%29.jpg"
|
26 |
path_input = "./h_erato.jpg"
|
27 |
urllib.request.urlretrieve(url, filename=path_input)
|
@@ -30,6 +31,15 @@ url = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Monarch_In_May.
|
|
30 |
path_input = "./d_plexippus.jpg"
|
31 |
urllib.request.urlretrieve(url, filename=path_input)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# normalisation
|
34 |
data_transforms_test = transforms.Compose([
|
35 |
transforms.Resize(256),
|
@@ -86,7 +96,7 @@ im = gr.inputs.Image(shape=(512, 512), image_mode='RGB',
|
|
86 |
|
87 |
title = "Butterfly Classification Demo"
|
88 |
description = "A pretrained ResNet18 CNN trained on the Leeds Butterfly Dataset. Libraries: PyTorch, Gradio."
|
89 |
-
examples = [['./h_erato.jpg'],['d_plexippus.jpg']]
|
90 |
article_text = markdown.markdown('''
|
91 |
|
92 |
<h1 style="color:white">PyTorch image classification - A pretrained ResNet18 CNN trained on the <a href="http://www.josiahwang.com/dataset/leedsbutterfly/">Leeds Butterfly Dataset</a></h1>
|
|
|
22 |
path_model = "./model_state_restnet_leeds_butterfly.pth"
|
23 |
gdown.download(url, path_model, quiet=False)
|
24 |
|
25 |
+
# example images
|
26 |
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Red_postman_butterfly_%28Heliconius_erato%29.jpg/1599px-Red_postman_butterfly_%28Heliconius_erato%29.jpg"
|
27 |
path_input = "./h_erato.jpg"
|
28 |
urllib.request.urlretrieve(url, filename=path_input)
|
|
|
31 |
path_input = "./d_plexippus.jpg"
|
32 |
urllib.request.urlretrieve(url, filename=path_input)
|
33 |
|
34 |
+
url = "https://drive.google.com/uc?id=130VEfv--EYtVCVoHo4zt4lrKaWzP6w74"
|
35 |
+
path_input = "./j_coenia.jpg"
|
36 |
+
urllib.request.urlretrieve(url, filename=path_input)
|
37 |
+
|
38 |
+
url = "https://drive.google.com/uc?id=1CiWShQYIm2N0fkVaWJpftlXZFqwjsXhA"
|
39 |
+
path_input = "./p_cresphontes.jpg"
|
40 |
+
urllib.request.urlretrieve(url, filename=path_input)
|
41 |
+
|
42 |
+
|
43 |
# normalisation
|
44 |
data_transforms_test = transforms.Compose([
|
45 |
transforms.Resize(256),
|
|
|
96 |
|
97 |
title = "Butterfly Classification Demo"
|
98 |
description = "A pretrained ResNet18 CNN trained on the Leeds Butterfly Dataset. Libraries: PyTorch, Gradio."
|
99 |
+
examples = [['./h_erato.jpg'],['d_plexippus.jpg'],['j_coenia.jpg'],['p_cresphontes.jpg']]
|
100 |
article_text = markdown.markdown('''
|
101 |
|
102 |
<h1 style="color:white">PyTorch image classification - A pretrained ResNet18 CNN trained on the <a href="http://www.josiahwang.com/dataset/leedsbutterfly/">Leeds Butterfly Dataset</a></h1>
|