Spaces:
Build error
Build error
fix missing img
Browse files
app.py
CHANGED
@@ -7,6 +7,8 @@ model = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pretrained=True).eva
|
|
7 |
response = requests.get("https://git.io/JJkYN")
|
8 |
labels = response.text.split("\n")
|
9 |
|
|
|
|
|
10 |
def predict(inp):
|
11 |
inp = transforms.ToTensor()(inp).unsqueeze(0)
|
12 |
with torch.no_grad():
|
@@ -17,7 +19,7 @@ def predict(inp):
|
|
17 |
demo = gr.Interface(fn=predict,
|
18 |
inputs=gr.inputs.Image(type="pil"),
|
19 |
outputs=gr.outputs.Label(num_top_classes=3),
|
20 |
-
examples=[["
|
21 |
)
|
22 |
|
23 |
demo.launch()
|
|
|
7 |
response = requests.get("https://git.io/JJkYN")
|
8 |
labels = response.text.split("\n")
|
9 |
|
10 |
+
torch.hub.download_url_to_file("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg")
|
11 |
+
|
12 |
def predict(inp):
|
13 |
inp = transforms.ToTensor()(inp).unsqueeze(0)
|
14 |
with torch.no_grad():
|
|
|
19 |
demo = gr.Interface(fn=predict,
|
20 |
inputs=gr.inputs.Image(type="pil"),
|
21 |
outputs=gr.outputs.Label(num_top_classes=3),
|
22 |
+
examples=[["dog.jpg"]],
|
23 |
)
|
24 |
|
25 |
demo.launch()
|