Spaces:
Runtime error
Runtime error
galatasaray
commited on
Commit
•
a47966f
1
Parent(s):
b8fc113
cwd
Browse files
app.py
CHANGED
@@ -2,13 +2,16 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
|
|
|
|
|
|
|
5 |
# Images
|
6 |
#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')
|
7 |
#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/bus.jpg', 'bus.jpg')
|
8 |
|
9 |
# Model
|
10 |
#model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update
|
11 |
-
model = torch.hub.load('/yolov5', 'custom', path='/saved_model/s1000_best.pt', source='local') # local model
|
12 |
|
13 |
|
14 |
def yolo(im, size=640):
|
@@ -30,7 +33,7 @@ article = "<p style='text-align: center'>YOLOv5 is a family of compound-scaled o
|
|
30 |
"and export to ONNX, CoreML and TFLite. <a href='https://github.com/ultralytics/yolov5'>Source code</a> |" \
|
31 |
"<a href='https://apps.apple.com/app/id1452689527'>iOS App</a> | <a href='https://pytorch.org/hub/ultralytics_yolov5'>PyTorch Hub</a></p>"
|
32 |
|
33 |
-
path_folder = '/datasets/s1000/'
|
34 |
examples = [[path_folder+'s1000 (1).png'], [path_folder+'s1000 (2).png'],[path_folder+'s1000 (3).png'],[path_folder+'s1000 (4).png'],[path_folder+'s1000 (5).png']]
|
35 |
gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, analytics_enabled=False).launch(
|
36 |
debug=True)
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
|
5 |
+
import os
|
6 |
+
cwd = os.getcwd()
|
7 |
+
|
8 |
# Images
|
9 |
#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')
|
10 |
#torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/bus.jpg', 'bus.jpg')
|
11 |
|
12 |
# Model
|
13 |
#model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update
|
14 |
+
model = torch.hub.load(cwd+'/yolov5', 'custom', path=cwd+'/saved_model/s1000_best.pt', source='local') # local model
|
15 |
|
16 |
|
17 |
def yolo(im, size=640):
|
|
|
33 |
"and export to ONNX, CoreML and TFLite. <a href='https://github.com/ultralytics/yolov5'>Source code</a> |" \
|
34 |
"<a href='https://apps.apple.com/app/id1452689527'>iOS App</a> | <a href='https://pytorch.org/hub/ultralytics_yolov5'>PyTorch Hub</a></p>"
|
35 |
|
36 |
+
path_folder = cwd+'/datasets/s1000/'
|
37 |
examples = [[path_folder+'s1000 (1).png'], [path_folder+'s1000 (2).png'],[path_folder+'s1000 (3).png'],[path_folder+'s1000 (4).png'],[path_folder+'s1000 (5).png']]
|
38 |
gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, analytics_enabled=False).launch(
|
39 |
debug=True)
|