PranomVignesh
commited on
Commit
·
1df9a80
1
Parent(s):
724ab16
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
-
import yolov5
|
3 |
import os
|
|
|
4 |
from transformers import pipeline
|
5 |
|
6 |
imageClassifier = pipeline(task="image-classification",
|
7 |
model="PranomVignesh/Police-vs-Public")
|
8 |
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
model = yolov5.load('./best.pt', device="cpu")
|
12 |
|
13 |
def predict(image):
|
14 |
results = model([image], size=224)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import os
|
3 |
+
import torch
|
4 |
from transformers import pipeline
|
5 |
|
6 |
imageClassifier = pipeline(task="image-classification",
|
7 |
model="PranomVignesh/Police-vs-Public")
|
8 |
|
9 |
|
10 |
+
model = torch.hub.load(
|
11 |
+
'ultralytics/yolov5',
|
12 |
+
'custom',
|
13 |
+
path='./new_best.pt',
|
14 |
+
device="cpu",
|
15 |
+
force_reload=True
|
16 |
+
)
|
17 |
+
model.eval()
|
18 |
|
|
|
19 |
|
20 |
def predict(image):
|
21 |
results = model([image], size=224)
|