Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -87,3 +87,22 @@ def count_unique_trucks(video_path):
|
|
87 |
cap.release()
|
88 |
|
89 |
return {"Total Unique Trucks": len(unique_truck_ids)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
cap.release()
|
88 |
|
89 |
return {"Total Unique Trucks": len(unique_truck_ids)}
|
90 |
+
|
91 |
+
# Gradio UI function
|
92 |
+
def analyze_video(video_file):
|
93 |
+
result = count_unique_trucks(video_file)
|
94 |
+
return "\n".join([f"{key}: {value}" for key, value in result.items()])
|
95 |
+
|
96 |
+
# Define Gradio interface
|
97 |
+
import gradio as gr
|
98 |
+
iface = gr.Interface(
|
99 |
+
fn=analyze_video,
|
100 |
+
inputs=gr.Video(label="Upload Video"),
|
101 |
+
outputs=gr.Textbox(label="Analysis Result"),
|
102 |
+
title="YOLOv12x Unique Truck Counter",
|
103 |
+
description="Upload a video to count unique trucks using YOLOv12x and SORT tracking."
|
104 |
+
)
|
105 |
+
|
106 |
+
# Launch the Gradio app
|
107 |
+
if __name__ == "__main__":
|
108 |
+
iface.launch()
|