mojad121 commited on
Commit
0e04e8e
·
verified ·
1 Parent(s): 22a9a9a

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. app.py +34 -0
  3. best.torchscript +3 -0
  4. requirements.txt +9 -0
  5. test_image.jpg +0 -0
.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
+ best.torchscript filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """app.ipynb
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1nIR_ak2SXq9fwQmKpq4eupLwQU_SI4fn
8
+ """
9
+
10
+ import gradio as gr
11
+ import torch
12
+ import cv2
13
+ from ultralytics import YOLO
14
+ import numpy as np
15
+
16
+ model = YOLO("best.torchscript")
17
+
18
+ def predict(image):
19
+ results = model(image)
20
+ annotated = results[0].plot()
21
+ annotated_rgb = cv2.cvtColor(annotated, cv2.COLOR_BGR2RGB)
22
+ return annotated_rgb
23
+
24
+ iface = gr.Interface(
25
+ fn=predict,
26
+ inputs=gr.Image(type="numpy", label="Upload an image"),
27
+ outputs=gr.Image(type="numpy", label="Detected image"),
28
+ title="YOLOv8 Object Detection",
29
+ description="Upload an image to detect objects using a YOLOv8 model in TorchScript format.",
30
+ examples=None
31
+ )
32
+
33
+ if __name__ == "__main__":
34
+ iface.launch()
best.torchscript ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e3c0f08c1e1ba08508c3e929c8aba1bc16c066adab69db62c7db217c499edae
3
+ size 13054046
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ altair
2
+ pandas
3
+ streamlit
4
+ ultralytics
5
+ gradio
6
+ wandb
7
+ opencv-python-headless
8
+ torch
9
+ numpy
test_image.jpg ADDED