Spaces:
Runtime error
Runtime error
Commit
·
df67541
1
Parent(s):
7c71c15
update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def inference(input_image):
|
|
52 |
inputs = gr.inputs.Image(type='pil')
|
53 |
outputs = gr.outputs.Label(type="confidences",num_top_classes=5)
|
54 |
|
55 |
-
title = "
|
56 |
description = "Demo of a ResNet image classifier trained on the ImageNet dataset. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
57 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1512.03385' target='_blank'>Deep Residual Learning for Image Recognition</a> | <a href='https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py' target='_blank'>Github Repo</a></p>"
|
58 |
|
@@ -65,37 +65,3 @@ gr.Interface(inference,
|
|
65 |
article=article,
|
66 |
analytics_enabled=False).launch()
|
67 |
|
68 |
-
# import torch
|
69 |
-
# import requests
|
70 |
-
# import gradio as gr
|
71 |
-
|
72 |
-
# from torchvision import transforms
|
73 |
-
|
74 |
-
# """
|
75 |
-
# Built following https://www.gradio.app/image_classification_in_pytorch/.
|
76 |
-
# """
|
77 |
-
|
78 |
-
# # Load model
|
79 |
-
# model = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pretrained=True).eval()
|
80 |
-
|
81 |
-
# # Download human-readable labels for ImageNet.
|
82 |
-
# response = requests.get("https://git.io/JJkYN")
|
83 |
-
# labels = response.text.split("\n")
|
84 |
-
|
85 |
-
# def predict(inp):
|
86 |
-
# inp = transforms.ToTensor()(inp).unsqueeze(0)
|
87 |
-
# with torch.no_grad():
|
88 |
-
# prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
|
89 |
-
# confidences = {labels[i]: float(prediction[i]) for i in range(1000)}
|
90 |
-
# return confidences
|
91 |
-
|
92 |
-
# title = "Image Classifier"
|
93 |
-
|
94 |
-
# article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1512.03385' target='_blank'>Deep Residual Learning for Image Recognition</a> | <a href='https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py' target='_blank'>Github Repo</a></p>"
|
95 |
-
|
96 |
-
# gr.Interface(fn=predict,
|
97 |
-
# inputs=gr.inputs.Image(type="pil"),
|
98 |
-
# outputs=gr.outputs.Label(num_top_classes=3),
|
99 |
-
# examples=["example1.jpg", "example2.jpg"],
|
100 |
-
# theme="default",
|
101 |
-
# css=".footer{display:none !important}").launch()
|
|
|
52 |
inputs = gr.inputs.Image(type='pil')
|
53 |
outputs = gr.outputs.Label(type="confidences",num_top_classes=5)
|
54 |
|
55 |
+
title = "Image Recognition using ResNet"
|
56 |
description = "Demo of a ResNet image classifier trained on the ImageNet dataset. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
57 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1512.03385' target='_blank'>Deep Residual Learning for Image Recognition</a> | <a href='https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py' target='_blank'>Github Repo</a></p>"
|
58 |
|
|
|
65 |
article=article,
|
66 |
analytics_enabled=False).launch()
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|