Dricz commited on
Commit
29ffb70
1 Parent(s): 4a58eaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -5
app.py CHANGED
@@ -5,11 +5,32 @@ from ultralyticsplus import YOLO, render_result
5
  import cv2
6
  import numpy as np
7
  from transformers import pipeline
 
 
8
 
9
  model = YOLO('best (1).pt')
10
  model2 = pipeline('image-classification','Kaludi/csgo-weapon-classification')
11
  name = ['grenade','knife','pistol','rifle']
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  # for i, r in enumerate(results):
14
 
15
  # # Plot results image
@@ -92,11 +113,11 @@ outputs = [gr.Image( type="filepath", label="Output Image"),
92
  ]
93
 
94
 
95
- # examples = [['th (11).jpg', 640, 0.3, 0.6],
96
- # ['th (8).jpg', 640, 0.3, 0.6],
97
- # ['th (3).jpg', 640, 0.3, 0.6],
98
- # ['th.jpg', 640, 0.15, 0.6]
99
- # ]
100
 
101
 
102
 
 
5
  import cv2
6
  import numpy as np
7
  from transformers import pipeline
8
+ import requests
9
+ from io import BytesIO
10
 
11
  model = YOLO('best (1).pt')
12
  model2 = pipeline('image-classification','Kaludi/csgo-weapon-classification')
13
  name = ['grenade','knife','pistol','rifle']
14
 
15
+ url_example="https://drive.google.com/file/d/1bBq0bNmJ5X83tDWCzdzHSYCdg-aUL4xO/view?usp=drive_link"
16
+ url_example='https://drive.google.com/uc?id=' + url_example.split('/')[-2]
17
+ r = requests.get(url_example)
18
+ im1 = Image.open(BytesIO(r.content))
19
+
20
+ url_example="https://drive.google.com/file/d/16Z7QzvZ99fbEPj1sls_jOCJBsC0h_dYZ/view?usp=drive_link"
21
+ url_example='https://drive.google.com/uc?id=' + url_example.split('/')[-2]
22
+ r = requests.get(url_example)
23
+ im2 = Image.open(BytesIO(r.content))
24
+
25
+ url_example="https://drive.google.com/file/d/13mjTMS3eR0AKYSbV-Fpb3fTBno_T42JN/view?usp=drive_link"
26
+ url_example='https://drive.google.com/uc?id=' + url_example.split('/')[-2]
27
+ r = requests.get(url_example)
28
+ im3 = Image.open(BytesIO(r.content))
29
+
30
+ url_example="https://drive.google.com/file/d/13mjTMS3eR0AKYSbV-Fpb3fTBno_T42JN/view?usp=drive_link"
31
+ url_example='https://drive.google.com/uc?id=' + url_example.split('/')[-2]
32
+ r = requests.get(url_example)
33
+ im4 = Image.open(BytesIO(r.content))
34
  # for i, r in enumerate(results):
35
 
36
  # # Plot results image
 
113
  ]
114
 
115
 
116
+ examples = [[im1, 640, 0.3, 0.6],
117
+ [im2, 640, 0.3, 0.6],
118
+ [im3, 640, 0.3, 0.6],
119
+ [im4, 640, 0.15, 0.6]
120
+ ]
121
 
122
 
123