kbarnard commited on
Commit
06b9c08
1 Parent(s): bd911aa

Initial HF space

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ trash_mbari_09072023_640imgsz_50epochs_yolov8.pt filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,13 +1,11 @@
1
  ---
2
  title: Trash Detector
3
- emoji: 🚀
4
- colorFrom: red
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 3.43.2
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-4.0
11
  ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Trash Detector
3
+ emoji: 🗑️
4
+ colorFrom: blue
5
+ colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.40.1
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-4.0
11
  ---
 
 
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import glob
2
+ import gradio as gr
3
+ from ultralytics import YOLO
4
+
5
+ model_path = "trash_mbari_09072023_640imgsz_50epochs_yolov8.pt"
6
+ model = YOLO(model_path)
7
+
8
+
9
+ PREDICT_KWARGS = {
10
+ "classes": 0,
11
+ }
12
+
13
+
14
+ def run(image_path):
15
+ results = model.predict(image_path, **PREDICT_KWARGS)
16
+ return results[0].plot()[:, :, ::-1] # reverse channels for gradio
17
+
18
+
19
+ title = "Trash Detector"
20
+ description = (
21
+ ""
22
+ )
23
+
24
+ examples = glob.glob("images/*.png")
25
+
26
+ interface = gr.Interface(
27
+ run,
28
+ inputs=[gr.components.Image(type="filepath")],
29
+ outputs=gr.components.Image(type="numpy"),
30
+ title=title,
31
+ description=description,
32
+ examples=examples,
33
+ )
34
+
35
+ interface.queue().launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ultralytics==8.0.158
trash_mbari_09072023_640imgsz_50epochs_yolov8.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:deebcced65ec08042d982522dd5326b0137b0b7935bf41ed51a10e714d54226e
3
+ size 136708926