hb-setosys commited on
Commit
68b2596
·
verified ·
1 Parent(s): c3b9d4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -83,7 +83,7 @@ def count_people_video(video_path):
83
 
84
  def analyze_video(video_file):
85
  # Extract video path from uploaded file
86
- video_path = video_file if isinstance(video_file, str) else video_file.name
87
 
88
  # Ensure path exists
89
  if not os.path.exists(video_path):
@@ -100,7 +100,7 @@ def analyze_image(image):
100
  # Gradio Interface for Image Processing
101
  image_interface = gr.Interface(
102
  fn=analyze_image,
103
- inputs=gr.Image(type="pil", label="Upload Image"),
104
  outputs=[gr.Image(label="Processed Image"), gr.Textbox(label="People Counting Results")],
105
  title="YOLO People Counter (Image)",
106
  description="Upload an image to detect and count people using YOLOv3."
@@ -109,7 +109,7 @@ image_interface = gr.Interface(
109
  # Gradio Interface for Video Processing
110
  video_interface = gr.Interface(
111
  fn=analyze_video,
112
- inputs=gr.Video(type="file", label="Upload Video"), # Ensure video is treated as a file
113
  outputs=gr.Textbox(label="People Counting Results"),
114
  title="YOLO People Counter (Video)",
115
  description="Upload a video to detect and count people using YOLOv3."
 
83
 
84
  def analyze_video(video_file):
85
  # Extract video path from uploaded file
86
+ video_path = video_file.name # No need for `type="file"`
87
 
88
  # Ensure path exists
89
  if not os.path.exists(video_path):
 
100
  # Gradio Interface for Image Processing
101
  image_interface = gr.Interface(
102
  fn=analyze_image,
103
+ inputs=gr.Image(label="Upload Image"),
104
  outputs=[gr.Image(label="Processed Image"), gr.Textbox(label="People Counting Results")],
105
  title="YOLO People Counter (Image)",
106
  description="Upload an image to detect and count people using YOLOv3."
 
109
  # Gradio Interface for Video Processing
110
  video_interface = gr.Interface(
111
  fn=analyze_video,
112
+ inputs=gr.Video(label="Upload Video"), # Remove `type="file"`
113
  outputs=gr.Textbox(label="People Counting Results"),
114
  title="YOLO People Counter (Video)",
115
  description="Upload a video to detect and count people using YOLOv3."