jonathanagustin
commited on
Commit
•
85562af
1
Parent(s):
4bc37d4
simplify + remove analytics
Browse files
app.py
CHANGED
@@ -39,8 +39,6 @@ from ultralytics import YOLO
|
|
39 |
|
40 |
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
41 |
|
42 |
-
model = YOLO("yolov8x.pt")
|
43 |
-
|
44 |
|
45 |
class SearchFilter(Enum):
|
46 |
"""
|
@@ -59,6 +57,7 @@ class SearchFilter(Enum):
|
|
59 |
used in YouTube search queries, and the second element is a human-readable
|
60 |
string describing the filter.
|
61 |
"""
|
|
|
62 |
LIVE = ("EgJAAQ%3D%3D", "Live")
|
63 |
VIDEO = ("EgIQAQ%3D%3D", "Video")
|
64 |
|
@@ -99,6 +98,7 @@ class SearchService:
|
|
99 |
get_youtube_url: Constructs a YouTube URL for a given video ID.
|
100 |
get_stream: Retrieves the stream URL for a given YouTube video URL.
|
101 |
"""
|
|
|
102 |
@staticmethod
|
103 |
def search(query: Optional[str], filter: SearchFilter = SearchFilter.VIDEO):
|
104 |
"""Searches YouTube for videos matching the given query and filter.
|
@@ -190,6 +190,8 @@ class SearchService:
|
|
190 |
|
191 |
|
192 |
INITIAL_STREAMS = SearchService.search("world live cams", SearchFilter.LIVE)
|
|
|
|
|
193 |
class LiveYouTubeObjectDetector:
|
194 |
"""
|
195 |
LiveYouTubeObjectDetector is a class that integrates object detection into live YouTube streams.
|
@@ -219,6 +221,7 @@ class LiveYouTubeObjectDetector:
|
|
219 |
get_live_streams: Searches for live streams based on a query.
|
220 |
render: Sets up and launches the Gradio interface.
|
221 |
"""
|
|
|
222 |
def __init__(self):
|
223 |
"""Initializes the LiveYouTubeObjectDetector with YOLO model and UI components."""
|
224 |
logging.getLogger().setLevel(logging.DEBUG)
|
@@ -343,7 +346,7 @@ class LiveYouTubeObjectDetector:
|
|
343 |
The Gradio interface allows users to search for live YouTube streams, select a stream,
|
344 |
and run object detection on the selected live stream.
|
345 |
"""
|
346 |
-
with gr.Blocks(title="Object Detection in Live YouTube Streams", css="footer {visibility: hidden}") as app:
|
347 |
self.page_title.render()
|
348 |
with gr.Column():
|
349 |
with gr.Group():
|
|
|
39 |
|
40 |
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
41 |
|
|
|
|
|
42 |
|
43 |
class SearchFilter(Enum):
|
44 |
"""
|
|
|
57 |
used in YouTube search queries, and the second element is a human-readable
|
58 |
string describing the filter.
|
59 |
"""
|
60 |
+
|
61 |
LIVE = ("EgJAAQ%3D%3D", "Live")
|
62 |
VIDEO = ("EgIQAQ%3D%3D", "Video")
|
63 |
|
|
|
98 |
get_youtube_url: Constructs a YouTube URL for a given video ID.
|
99 |
get_stream: Retrieves the stream URL for a given YouTube video URL.
|
100 |
"""
|
101 |
+
|
102 |
@staticmethod
|
103 |
def search(query: Optional[str], filter: SearchFilter = SearchFilter.VIDEO):
|
104 |
"""Searches YouTube for videos matching the given query and filter.
|
|
|
190 |
|
191 |
|
192 |
INITIAL_STREAMS = SearchService.search("world live cams", SearchFilter.LIVE)
|
193 |
+
|
194 |
+
|
195 |
class LiveYouTubeObjectDetector:
|
196 |
"""
|
197 |
LiveYouTubeObjectDetector is a class that integrates object detection into live YouTube streams.
|
|
|
221 |
get_live_streams: Searches for live streams based on a query.
|
222 |
render: Sets up and launches the Gradio interface.
|
223 |
"""
|
224 |
+
|
225 |
def __init__(self):
|
226 |
"""Initializes the LiveYouTubeObjectDetector with YOLO model and UI components."""
|
227 |
logging.getLogger().setLevel(logging.DEBUG)
|
|
|
346 |
The Gradio interface allows users to search for live YouTube streams, select a stream,
|
347 |
and run object detection on the selected live stream.
|
348 |
"""
|
349 |
+
with gr.Blocks(title="Object Detection in Live YouTube Streams", css="footer {visibility: hidden}", analytics_enabled=False) as app:
|
350 |
self.page_title.render()
|
351 |
with gr.Column():
|
352 |
with gr.Group():
|