capradeepgujaran commited on
Commit
b6ce847
·
verified ·
1 Parent(s): 1cddd79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -96,21 +96,21 @@ def create_monitor_interface():
96
  gr.Markdown("# Real-time Safety Monitoring System")
97
 
98
  with gr.Row():
99
- webcam = gr.Image(source="webcam", streaming=True, label="Webcam Feed")
100
  output_image = gr.Image(label="Analysis Feed")
101
 
102
  analysis_text = gr.Textbox(label="Safety Analysis", lines=5)
103
 
104
- def analyze_stream(frame):
105
- if frame is None:
106
  return None, "Webcam not started"
107
- processed_frame, analysis = monitor.process_frame(frame)
108
  return processed_frame, analysis
109
 
110
- webcam.stream(
111
  fn=analyze_stream,
 
112
  outputs=[output_image, analysis_text],
113
- show_progress=False
114
  )
115
 
116
  return demo
 
96
  gr.Markdown("# Real-time Safety Monitoring System")
97
 
98
  with gr.Row():
99
+ webcam = gr.Webcam(label="Webcam Feed")
100
  output_image = gr.Image(label="Analysis Feed")
101
 
102
  analysis_text = gr.Textbox(label="Safety Analysis", lines=5)
103
 
104
+ def analyze_stream(image):
105
+ if image is None:
106
  return None, "Webcam not started"
107
+ processed_frame, analysis = monitor.process_frame(image)
108
  return processed_frame, analysis
109
 
110
+ webcam.change(
111
  fn=analyze_stream,
112
+ inputs=[webcam],
113
  outputs=[output_image, analysis_text],
 
114
  )
115
 
116
  return demo