Update app.py
Browse files
app.py
CHANGED
|
@@ -73,7 +73,7 @@ transform = v2.Compose([
|
|
| 73 |
efficientnet = models.efficientnet_v2_m(weights='EfficientNet_V2_M_Weights.DEFAULT')
|
| 74 |
efficientnet.classifier = new_layers
|
| 75 |
efficientnet.load_state_dict(checkpoint['model_state_dict'])
|
| 76 |
-
efficientnet.eval()
|
| 77 |
|
| 78 |
def predict(img):
|
| 79 |
input_img = transform(img)
|
|
@@ -115,12 +115,12 @@ with gr.Blocks(title='Ball Python Morph Identifier') as demo:
|
|
| 115 |
img_input = gr.Image(type="pil", label="Upload/Paste Image")
|
| 116 |
gr.Examples(
|
| 117 |
examples=[
|
| 118 |
-
["enchi_albino_clown.png"],
|
| 119 |
-
["mojave_ghi.png"],
|
| 120 |
-
["hypo_banana_pastel_enchi.png"],
|
| 121 |
-
["yb_pastel_gravel.png"],
|
| 122 |
-
["ivory.png"
|
| 123 |
-
|
| 124 |
inputs=[img_input]
|
| 125 |
)
|
| 126 |
predict_btn = gr.Button("Identify Morphs", variant="primary")
|
|
@@ -130,4 +130,4 @@ with gr.Blocks(title='Ball Python Morph Identifier') as demo:
|
|
| 130 |
|
| 131 |
predict_btn.click(fn=predict, inputs=[img_input], outputs=label_output)
|
| 132 |
|
| 133 |
-
demo.launch(
|
|
|
|
| 73 |
efficientnet = models.efficientnet_v2_m(weights='EfficientNet_V2_M_Weights.DEFAULT')
|
| 74 |
efficientnet.classifier = new_layers
|
| 75 |
efficientnet.load_state_dict(checkpoint['model_state_dict'])
|
| 76 |
+
efficientnet.to(device).eval()
|
| 77 |
|
| 78 |
def predict(img):
|
| 79 |
input_img = transform(img)
|
|
|
|
| 115 |
img_input = gr.Image(type="pil", label="Upload/Paste Image")
|
| 116 |
gr.Examples(
|
| 117 |
examples=[
|
| 118 |
+
["enchi_albino_clown.png", "Enchi, Albino, Clown"],
|
| 119 |
+
["mojave_ghi.png", "Mojave, GHI"],
|
| 120 |
+
["hypo_banana_pastel_enchi.png", "Hypo, Banana, Pastel, Enchi"],
|
| 121 |
+
["yb_pastel_gravel.png", "Yellow Belly, Pastel, Gravel"],
|
| 122 |
+
["ivory.png", "Super Yellow Belly"]
|
| 123 |
+
],
|
| 124 |
inputs=[img_input]
|
| 125 |
)
|
| 126 |
predict_btn = gr.Button("Identify Morphs", variant="primary")
|
|
|
|
| 130 |
|
| 131 |
predict_btn.click(fn=predict, inputs=[img_input], outputs=label_output)
|
| 132 |
|
| 133 |
+
demo.launch()
|