Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,13 @@ import gradio as gr
|
|
5 |
import requests
|
6 |
from PIL import Image
|
7 |
|
8 |
-
weights='yolov5s-cls.pt'
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
model = DetectMultiBackend(weights)
|
11 |
|
12 |
# load imagenet 1000 labels
|
13 |
response = requests.get("https://git.io/JJkYN")
|
@@ -40,6 +44,6 @@ def predict(inp):
|
|
40 |
|
41 |
gr.Interface(fn=predict,
|
42 |
inputs=gr.Image(type="pil"),
|
43 |
-
outputs="label",labels=labels).launch(
|
44 |
|
45 |
#outputs=gr.Label(num_top_classes=5))
|
|
|
5 |
import requests
|
6 |
from PIL import Image
|
7 |
|
8 |
+
# weights='/content/drive/MyDrive/yolov5/yolov5s-cls.pt'
|
9 |
+
|
10 |
+
# model = DetectMultiBackend(weights)
|
11 |
+
|
12 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', 'yolov5m-cls.pt').eval() # load from PyTorch Hub
|
13 |
+
model.classify = True
|
14 |
|
|
|
15 |
|
16 |
# load imagenet 1000 labels
|
17 |
response = requests.get("https://git.io/JJkYN")
|
|
|
44 |
|
45 |
gr.Interface(fn=predict,
|
46 |
inputs=gr.Image(type="pil"),
|
47 |
+
outputs="label",labels=labels).launch()
|
48 |
|
49 |
#outputs=gr.Label(num_top_classes=5))
|