AlshimaaGamalAlsaied commited on
Commit
150fa49
·
1 Parent(s): d334981
Files changed (1) hide show
  1. app.py +3 -29
app.py CHANGED
@@ -37,24 +37,6 @@ def yolov7_inference(
37
  results = model([image], size=image_size)
38
  return results.render()[0]
39
 
40
- def yolov7_inference_video(
41
- video: gr.inputs.Video = None,
42
- model_path: gr.inputs.Dropdown = None,
43
-
44
- ):
45
- """
46
- YOLOv7 inference function
47
- Args:
48
- video: Input video
49
- model_path: Path to the model
50
-
51
- Returns:
52
- Rendered video
53
- """
54
-
55
- model = yolov7.load(model_path, device="cpu", hf_model=True, trace=False)
56
- results = model([video])
57
- return results
58
 
59
 
60
  inputs = [
@@ -74,7 +56,7 @@ inputs = [
74
  #gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold")
75
  ]
76
 
77
- outputs = [gr.outputs.Image(type="filepath", label="Output Image"), gr.outputs.Video(type="filepath", label="Output Video")]
78
  title = "Smart Environmental Eye (SEE)"
79
 
80
  examples = [['image1.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45], ['image2.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45], ['image3.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45]]
@@ -87,14 +69,6 @@ demo_app = gr.Interface(
87
  cache_examples=True,
88
  theme='huggingface',
89
  )
90
- demo_app_video = gr.Interface(
91
- fn=yolov7_inference_video,
92
- inputs=inputs,
93
- outputs=outputs,
94
- title=title,
95
- examples=examples,
96
- cache_examples=True,
97
- theme='huggingface',
98
- )
99
  demo_app.launch(debug=True, enable_queue=True)
100
- demo_app_video.launch(debug=True, enable_queue=True)
 
37
  results = model([image], size=image_size)
38
  return results.render()[0]
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
 
42
  inputs = [
 
56
  #gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold")
57
  ]
58
 
59
+ outputs = gr.outputs.Image(type="filepath", label="Output Image")
60
  title = "Smart Environmental Eye (SEE)"
61
 
62
  examples = [['image1.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45], ['image2.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45], ['image3.jpg', 'alshimaa/model_yolo7', 640, 0.25, 0.45]]
 
69
  cache_examples=True,
70
  theme='huggingface',
71
  )
72
+
 
 
 
 
 
 
 
 
73
  demo_app.launch(debug=True, enable_queue=True)
74
+