Atualli commited on
Commit
9b78f64
1 Parent(s): dc4b4f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -12,6 +12,8 @@ torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master
12
  torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
13
  torch.hub.download_url_to_file('https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/main/assets/dog.jpg', 'dog.jpg')
14
 
 
 
15
  def yolox_inference(
16
  image_path: gr.inputs.Image = None,
17
  model_path: gr.inputs.Dropdown = 'kadirnar/yolox_s-v0.1.1',
@@ -29,15 +31,17 @@ def yolox_inference(
29
  Rendered image
30
  """
31
 
32
- model = YoloxDetector(model_path, config_path=config_path, device="cpu", hf_model=True)
33
  #pred = model.predict(image_path=image_path, image_size=image_size)
34
- model.torchyolo = True
35
- pred2 = model.predict(image_path=image_path, image_size=image_size)
36
- #text = "Ola"
37
- #print (vars(model))
38
- #print (pred2[0])
39
- #print (pred2[1])
40
- #print (pred2[2])
 
 
41
 
42
 
43
  tensor = {
 
12
  torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
13
  torch.hub.download_url_to_file('https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/main/assets/dog.jpg', 'dog.jpg')
14
 
15
+ model = YoloxDetector('kadirnar/yolox_s-v0.1.1', 'configs.yolox_s', device="cpu", hf_model=True)
16
+
17
  def yolox_inference(
18
  image_path: gr.inputs.Image = None,
19
  model_path: gr.inputs.Dropdown = 'kadirnar/yolox_s-v0.1.1',
 
31
  Rendered image
32
  """
33
 
34
+ #model = YoloxDetector(model_path, config_path=config_path, device="cpu", hf_model=True)
35
  #pred = model.predict(image_path=image_path, image_size=image_size)
36
+ pred2 = []
37
+ if model :
38
+ model.torchyolo = True
39
+ pred2 = model.predict(image_path=image_path, image_size=image_size)
40
+ #text = "Ola"
41
+ #print (vars(model))
42
+ #print (pred2[0])
43
+ #print (pred2[1])
44
+ #print (pred2[2])
45
 
46
 
47
  tensor = {