Upload app.py
Browse files
app.py
CHANGED
@@ -180,9 +180,9 @@ def predict(img):
|
|
180 |
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
181 |
])
|
182 |
|
183 |
-
img_tensor = preprocess(img).unsqueeze(0)
|
184 |
|
185 |
-
with torch.inference_mode():
|
186 |
logits = model(img_tensor)
|
187 |
preds = logits.argmax(dim=1)
|
188 |
return classes[preds.item()]
|
@@ -192,10 +192,10 @@ def predict(img):
|
|
192 |
"""gradio interface"""
|
193 |
demo = gr.Interface(
|
194 |
fn=predict,
|
195 |
-
inputs=gr.Image(type="pil", width=244, height=244),
|
196 |
-
outputs="label",
|
197 |
title="Animal Classifier",
|
198 |
-
description="Classify
|
199 |
)
|
200 |
|
201 |
"""launch interface"""
|
|
|
180 |
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
181 |
])
|
182 |
|
183 |
+
img_tensor = preprocess(img).unsqueeze(0)
|
184 |
|
185 |
+
with torch.inference_mode():
|
186 |
logits = model(img_tensor)
|
187 |
preds = logits.argmax(dim=1)
|
188 |
return classes[preds.item()]
|
|
|
192 |
"""gradio interface"""
|
193 |
demo = gr.Interface(
|
194 |
fn=predict,
|
195 |
+
inputs=gr.Image(type="pil", width=244, height=244),
|
196 |
+
outputs="label",
|
197 |
title="Animal Classifier",
|
198 |
+
description="Classify 30 animal categories: antelope, buffalo, chimpanzee, cow, deer, dolphin, elephant, fox, giant+panda, giraffe, gorilla, grizzly+bear, hamster, hippopotamus, horse, humpback+whale, leopard, lion, moose, otter, ox, pig, polar+bear, rabbit, rhinoceros, seal, sheep, squirrel, tiger, zebra"
|
199 |
)
|
200 |
|
201 |
"""launch interface"""
|