Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,9 @@ state_dict = torch.load('up500Model.pt', map_location='cpu')
|
|
| 14 |
model.load_state_dict(state_dict)
|
| 15 |
model.eval()
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
imgTransforms = transforms.Compose([
|
| 18 |
transforms.Resize(256),
|
| 19 |
transforms.CenterCrop(224),
|
|
@@ -27,5 +30,5 @@ def predict(inp):
|
|
| 27 |
prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
|
| 28 |
return {LABELS[i]: float(prediction[i]) for i in range(2)}
|
| 29 |
|
| 30 |
-
iface = gr.Interface(predict, inputs=gr.inputs.Image(), outputs="label")
|
| 31 |
iface.launch()
|
|
|
|
| 14 |
model.load_state_dict(state_dict)
|
| 15 |
model.eval()
|
| 16 |
|
| 17 |
+
title = "VW Up! or Fiat 500"
|
| 18 |
+
description = "Demo for classification of automobiles. To use it, simply upload your image, or click one of the examples to load them."
|
| 19 |
+
|
| 20 |
imgTransforms = transforms.Compose([
|
| 21 |
transforms.Resize(256),
|
| 22 |
transforms.CenterCrop(224),
|
|
|
|
| 30 |
prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
|
| 31 |
return {LABELS[i]: float(prediction[i]) for i in range(2)}
|
| 32 |
|
| 33 |
+
iface = gr.Interface(predict, inputs=gr.inputs.Image(), outputs="label", title=title, description=description)
|
| 34 |
iface.launch()
|