ankanpy commited on
Commit
02d0bce
·
1 Parent(s): e242941

updated app.py

Browse files
Files changed (2) hide show
  1. app.py +41 -23
  2. requirements.txt +1 -1
app.py CHANGED
@@ -234,20 +234,36 @@ def process_video_interface(video_file, points):
234
 
235
 
236
  # Gradio Interface.
237
- with gr.Blocks(title="Lane Detection using OpenCV") as demo:
238
- gr.Markdown("# Lane Detection using OpenCV")
239
- gr.Markdown("Upload your video, select the four region points to make the ROI yo want to track. Click process video to get the output.")
240
- with gr.Row(equal_height=True):
241
- video_input = gr.Video(label="Input Video")
242
- extract_frame_button = gr.Button("Extract First Frame")
243
- with gr.Row(equal_height=True):
244
- first_frame_image = gr.Image(label="Click to select ROI points")
245
- original_frame_state = gr.State(None)
246
- points_state = gr.State([])
247
- with gr.Row(equal_height=True):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  process_button = gr.Button("Process Video")
249
  clear_points_button = gr.Button("Clear Points")
250
- output_video = gr.Video(label="Processed Video", width=640, height=360)
 
251
 
252
  # Extract the first frame and store it
253
  extract_frame_button.click(
@@ -268,15 +284,17 @@ with gr.Blocks(title="Lane Detection using OpenCV") as demo:
268
 
269
  # Process the video using the selected ROI
270
  process_button.click(fn=process_video_interface, inputs=[video_input, points_state], outputs=output_video)
271
-
272
  # Adding examples
273
- gr.Examples(
274
- examples=[
275
- "./lane.mp4"
276
- ],
277
- inputs=video_input
278
- )
279
-
280
-
281
-
282
- demo.launch()
 
 
 
234
 
235
 
236
  # Gradio Interface.
237
+ with gr.Blocks(title="Lane Detection using OpenCV", theme=gr.themes.Soft()) as demo:
238
+ gr.HTML(
239
+ """
240
+ <h1 style='text-align: center'>
241
+ Lane Detection using OpenCV
242
+ </h1>
243
+ """
244
+ )
245
+ gr.HTML(
246
+ """
247
+ <h3 style='text-align: center'>
248
+ <a href='https://opencv.org/university/' target='_blank'>OpenCV Courses</a> | <a href='https://github.com/OpenCV-University' target='_blank'>Github</a>
249
+ </h3>
250
+ """
251
+ )
252
+ gr.Markdown(
253
+ "Upload your video, select the four region points to make the ROI yo want to track. Click process video to get the output."
254
+ )
255
+ with gr.Row():
256
+ with gr.Column(scale=1, min_width=300):
257
+ video_input = gr.Video(label="Input Video")
258
+ extract_frame_button = gr.Button("Extract First Frame")
259
+ with gr.Column(scale=1, min_width=300):
260
+ first_frame_image = gr.Image(label="Click to select ROI points")
261
+ original_frame_state = gr.State(None)
262
+ points_state = gr.State([])
263
  process_button = gr.Button("Process Video")
264
  clear_points_button = gr.Button("Clear Points")
265
+ with gr.Column(scale=1, min_width=300):
266
+ output_video = gr.Video(label="Processed Video")
267
 
268
  # Extract the first frame and store it
269
  extract_frame_button.click(
 
284
 
285
  # Process the video using the selected ROI
286
  process_button.click(fn=process_video_interface, inputs=[video_input, points_state], outputs=output_video)
287
+
288
  # Adding examples
289
+ gr.Examples(examples=["./lane.mp4"], inputs=video_input)
290
+ gr.HTML(
291
+ """
292
+ <h3 style='text-align: center'>
293
+ Developed with ❤️ by OpenCV
294
+ </h3>
295
+ """
296
+ )
297
+
298
+
299
+ if __name__ == "__main__":
300
+ demo.launch()
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
  opencv-python==4.10.0.84
2
- gradio==5.5.0
 
1
  opencv-python==4.10.0.84
2
+ gradio==5.23.3