shriarul5273 commited on
Commit
36327d0
·
verified ·
1 Parent(s): 5d58bc6

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +2 -1
  2. get_package_version.py +27 -0
  3. requirements.txt +2 -2
app.py CHANGED
@@ -7,6 +7,7 @@ import numpy as np
7
  import gradio as gr
8
  import time
9
  data = 'data/coco128.yaml'
 
10
 
11
 
12
  def letterbox(im, new_shape=(640, 640), color=(114, 114, 114), auto=True, scaleup=True, stride=32):
@@ -49,7 +50,7 @@ names = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', '
49
 
50
 
51
 
52
-
53
  def detect(im,model,device,iou_threshold=0.45,confidence_threshold=0.25):
54
  im = np.array(im)
55
  imgsz=(640, 640) # inference size (pixels)
 
7
  import gradio as gr
8
  import time
9
  data = 'data/coco128.yaml'
10
+ import spaces
11
 
12
 
13
  def letterbox(im, new_shape=(640, 640), color=(114, 114, 114), auto=True, scaleup=True, stride=32):
 
50
 
51
 
52
 
53
+ @spaces.GPU
54
  def detect(im,model,device,iou_threshold=0.45,confidence_threshold=0.25):
55
  im = np.array(im)
56
  imgsz=(640, 640) # inference size (pixels)
get_package_version.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Map package names to their import names if they differ
2
+ package_map = {
3
+ "ipython": "IPython",
4
+ "numpy": "numpy",
5
+ "opencv-python": "cv2",
6
+ "Pillow": "PIL",
7
+ "scipy": "scipy",
8
+ "torch": "torch",
9
+ "torchvision": "torchvision",
10
+ "tqdm": "tqdm",
11
+ "seaborn": "seaborn",
12
+ "gradio": "gradio",
13
+ "psutil": "psutil",
14
+ "pandas": "pandas",
15
+ }
16
+
17
+ with open("requirements.txt", "w") as f:
18
+ for package, import_name in package_map.items():
19
+ try:
20
+ mod = __import__(import_name)
21
+ version = getattr(mod, "__version__", "latest")
22
+ f.write(f"{package}=={version}\n")
23
+ except ImportError:
24
+ f.write(f"{package}\n")
25
+ print(f"{package} is not installed and version is unknown.")
26
+
27
+ print("requirements.txt file has been created.")
requirements.txt CHANGED
@@ -3,8 +3,8 @@ numpy==1.24.3
3
  opencv-python==4.10.0.84
4
  Pillow==11.0.0
5
  scipy==1.14.1
6
- torch==2.3.0
7
- torchvision==0.18.0
8
  tqdm==4.67.1
9
  seaborn==0.13.2
10
  gradio==5.9.1
 
3
  opencv-python==4.10.0.84
4
  Pillow==11.0.0
5
  scipy==1.14.1
6
+ torch==2.2.2
7
+ torchvision==0.17.2
8
  tqdm==4.67.1
9
  seaborn==0.13.2
10
  gradio==5.9.1