fohy24 commited on
Commit ·
164d735
1
Parent(s): 2ded624
changed out examples for new morphs
Browse files
app.py
CHANGED
|
@@ -49,20 +49,20 @@ model_path = hf_hub_download(repo_id="samfhy/morphmarket_model", filename="model
|
|
| 49 |
checkpoint = torch.load(model_path, map_location=device)
|
| 50 |
|
| 51 |
new_layers = nn.Sequential(
|
| 52 |
-
nn.LazyLinear(2048),
|
| 53 |
-
nn.BatchNorm1d(2048),
|
| 54 |
-
nn.ReLU(),
|
| 55 |
-
nn.Dropout(0.5),
|
| 56 |
-
nn.LazyLinear(num_labels)
|
| 57 |
-
)
|
| 58 |
|
| 59 |
IMAGE_SIZE = 480
|
| 60 |
transform = v2.Compose([
|
| 61 |
-
v2.ToImage(),
|
| 62 |
-
v2.Resize((IMAGE_SIZE, IMAGE_SIZE)),
|
| 63 |
-
v2.ToDtype(torch.float32),
|
| 64 |
-
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 65 |
-
])
|
| 66 |
|
| 67 |
efficientnet = models.efficientnet_v2_l(weights='EfficientNet_V2_L_Weights.DEFAULT')
|
| 68 |
efficientnet.classifier = new_layers
|
|
@@ -87,7 +87,7 @@ gr.Interface(fn=predict,
|
|
| 87 |
inputs=[gr.Image(type="pil"),
|
| 88 |
gr.Slider(0, 1, value=0.5, label="Confidence", info="Show predictions that are above this confidence level")],
|
| 89 |
outputs=gr.Label(),
|
| 90 |
-
examples=[["
|
| 91 |
title='Ball Python Morph Identifier',
|
| 92 |
description="Upload or paste an image of your ball python to identify its morphs!"
|
| 93 |
).launch()
|
|
|
|
| 49 |
checkpoint = torch.load(model_path, map_location=device)
|
| 50 |
|
| 51 |
new_layers = nn.Sequential(
|
| 52 |
+
nn.LazyLinear(2048),
|
| 53 |
+
nn.BatchNorm1d(2048),
|
| 54 |
+
nn.ReLU(),
|
| 55 |
+
nn.Dropout(0.5),
|
| 56 |
+
nn.LazyLinear(num_labels)
|
| 57 |
+
)
|
| 58 |
|
| 59 |
IMAGE_SIZE = 480
|
| 60 |
transform = v2.Compose([
|
| 61 |
+
v2.ToImage(),
|
| 62 |
+
v2.Resize((IMAGE_SIZE, IMAGE_SIZE)),
|
| 63 |
+
v2.ToDtype(torch.float32),
|
| 64 |
+
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 65 |
+
])
|
| 66 |
|
| 67 |
efficientnet = models.efficientnet_v2_l(weights='EfficientNet_V2_L_Weights.DEFAULT')
|
| 68 |
efficientnet.classifier = new_layers
|
|
|
|
| 87 |
inputs=[gr.Image(type="pil"),
|
| 88 |
gr.Slider(0, 1, value=0.5, label="Confidence", info="Show predictions that are above this confidence level")],
|
| 89 |
outputs=gr.Label(),
|
| 90 |
+
examples=[["enchi_albino_clown.png", 0.5], ["mojave_ghi.png", 0.5], ["hypo_banana_pastel_enchi.png", 0.5]],
|
| 91 |
title='Ball Python Morph Identifier',
|
| 92 |
description="Upload or paste an image of your ball python to identify its morphs!"
|
| 93 |
).launch()
|