Spaces:
Runtime error
Runtime error
Commit
·
f936f06
1
Parent(s):
03c00ff
Update app.py
Browse files
app.py
CHANGED
@@ -30,16 +30,16 @@ model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
|
30 |
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
31 |
|
32 |
# set image
|
33 |
-
image = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
|
34 |
|
35 |
# perform inference
|
36 |
-
|
|
|
37 |
|
38 |
# observe results
|
39 |
-
print(results[0].boxes)
|
40 |
-
render = render_result(model=model, image=image, result=results[0])
|
41 |
-
render.show()
|
42 |
-
'''
|
43 |
|
44 |
"""
|
45 |
The function below identifies the device which is availabe to make the prediction and uses it to load and infer the frame. Once it has results it will extract the labels and cordinates(Along with scores) for each object detected in the frame.
|
@@ -105,5 +105,13 @@ def __call__(self):
|
|
105 |
out.write(frame) # Write the frame onto the output.
|
106 |
ret, frame = player.read() # Read next frame.
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
30 |
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
31 |
|
32 |
# set image
|
33 |
+
#image = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
|
34 |
|
35 |
# perform inference
|
36 |
+
#def show(feed)
|
37 |
+
# return model.predict(feed)
|
38 |
|
39 |
# observe results
|
40 |
+
#print(results[0].boxes)
|
41 |
+
#render = render_result(model=model, image=image, result=results[0])
|
42 |
+
#render.show()
|
|
|
43 |
|
44 |
"""
|
45 |
The function below identifies the device which is availabe to make the prediction and uses it to load and infer the frame. Once it has results it will extract the labels and cordinates(Along with scores) for each object detected in the frame.
|
|
|
105 |
out.write(frame) # Write the frame onto the output.
|
106 |
ret, frame = player.read() # Read next frame.
|
107 |
|
108 |
+
with gr.Blocks() as app:
|
109 |
+
youtube_url = gr.Textbox(label="YouTube URL",value=f"{URL}")
|
110 |
+
load_button = gr.Button("Load Video")
|
111 |
+
run_button = gr.Button()
|
112 |
+
output_win = gr.Video()
|
113 |
|
114 |
+
load_button.click(load,youtube_url,output_win)
|
115 |
+
run_button.click()
|
116 |
+
|
117 |
+
app.launch(enable_queue=False)
|