Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,6 @@ import sys
|
|
| 5 |
import os
|
| 6 |
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
def process_video(video):
|
| 11 |
# 打开视频文件
|
| 12 |
cap = cv2.VideoCapture(video)
|
|
@@ -32,28 +30,24 @@ title = "Welcome to DDM DeepSort"
|
|
| 32 |
description = "Upload a video to process it using DDM and DeepSORT."
|
| 33 |
|
| 34 |
# Initialize Gradio interface with title and description
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
"""
|
| 54 |
-
with demo:
|
| 55 |
-
gr.HTML(html_content)
|
| 56 |
-
demo_video
|
| 57 |
|
| 58 |
demo.launch()
|
| 59 |
-
|
|
|
|
| 5 |
import os
|
| 6 |
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
|
|
|
|
|
|
|
| 8 |
def process_video(video):
|
| 9 |
# 打开视频文件
|
| 10 |
cap = cv2.VideoCapture(video)
|
|
|
|
| 30 |
description = "Upload a video to process it using DDM and DeepSORT."
|
| 31 |
|
| 32 |
# Initialize Gradio interface with title and description
|
| 33 |
+
with gr.Blocks() as demo:
|
| 34 |
+
gr.HTML("""
|
| 35 |
+
<div style="text-align: center;">
|
| 36 |
+
<h1>Welcome to My Video Processing App</h1>
|
| 37 |
+
<p>The author is a third-year undergraduate student at the School of Intelligent Science and Technology, Nanjing University, Suzhou Campus. </p>
|
| 38 |
+
<p>Since this project uses Hugging Face's free CPU, the processing speed is very slow. In the worst case, even a video with a dozen frames can take several minutes to process. Therefore, if possible, it is recommended to deploy on a device with a better GPU.</p>
|
| 39 |
+
<p>Although the YOLOv5 model supports up to 80 classes, my project is primarily focused on autonomous driving. Therefore, objects other than people and cars will be excluded after object detection.</p>
|
| 40 |
+
<p>If this is your first attempt, ensure that the video includes at least people and cars. Additionally, it's recommended that the video is not too long, ideally within 10 seconds.</p>
|
| 41 |
+
</div>
|
| 42 |
+
""")
|
| 43 |
+
|
| 44 |
+
gr.Interface(
|
| 45 |
+
fn=app_main,
|
| 46 |
+
inputs="video",
|
| 47 |
+
outputs="video",
|
| 48 |
+
title=title,
|
| 49 |
+
description=description
|
| 50 |
+
)
|
| 51 |
+
gr.Video(value="DDMDeepsort1.mp4", label="Demo Video")
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
demo.launch()
|
|
|