khengkok commited on
Commit
83db282
1 Parent(s): 825c313
Files changed (4) hide show
  1. .DS_Store +0 -0
  2. README.md +6 -5
  3. app.py +33 -0
  4. requirements.txt +2 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
README.md CHANGED
@@ -1,13 +1,14 @@
1
  ---
2
- title: Balloon Od
3
- emoji:
4
  colorFrom: indigo
5
- colorTo: indigo
 
6
  sdk: gradio
7
- sdk_version: 5.3.0
8
  app_file: app.py
9
  pinned: false
10
- short_description: Balloon Detector
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: balloon-od
3
+ emoji: 🐢
4
  colorFrom: indigo
5
+ colorTo: red
6
+ python_version: 3.8
7
  sdk: gradio
8
+ sdk_version: 4.0.2
9
  app_file: app.py
10
  pinned: false
11
+ license: apache-2.0
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import gradio as gr
3
+ from huggingface_hub import snapshot_download
4
+ import os
5
+
6
+ model_path = "/Users/markk/Downloads/best_int8_openvino_model"
7
+
8
+ def load_model(repo_id):
9
+ download_dir = snapshot_download(repo_id)
10
+ print(download_dir)
11
+ path = os.path.join(download_dir, "best_int8_openvino_model")
12
+ print(path)
13
+ detection_model = YOLO(path, task='detect')
14
+ return detection_model
15
+
16
+
17
+ def predict(pilimg):
18
+
19
+ source = pilimg
20
+ # x = np.asarray(pilimg)
21
+ # print(x.shape)
22
+ result = detection_model.predict(source, conf=0.5, iou=0.6)
23
+ out_pilimg = result[0].plot()
24
+ return out_pilimg
25
+
26
+
27
+ REPO_ID = "khengkok/balloon_yolov8"
28
+ detection_model = load_model(REPO_ID)
29
+
30
+ gr.Interface(fn=predict,
31
+ inputs=gr.Image(type="pil"),
32
+ outputs=gr.Image(type="pil")
33
+ ).launch(share=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ultralytics
2
+ huggingface_hub