hb-setosys commited on
Commit
3503d68
·
verified ·
1 Parent(s): 9bb7cec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
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()