sino72 commited on
Commit
d2f4d51
·
1 Parent(s): 0d98130

tiny improvement

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -170,6 +170,12 @@ def processVideo(inputPath, codec, model):
170
  cap.release()#释放
171
  return video_save_path,video_save_path,number_of_people
172
 
 
 
 
 
 
 
173
 
174
  #WebUi图形界面(block)
175
  with gr.Blocks() as demo:
@@ -189,6 +195,7 @@ with gr.Blocks() as demo:
189
  text_output = gr.Video()
190
  text_output_path = gr.Text(label="输出路径")
191
  total_ID = gr.Text(label="总人数")
 
192
  with gr.Row():
193
  with gr.Column():
194
  figure_number_output = gr.Plot(label="人流量")
@@ -228,6 +235,7 @@ with gr.Blocks() as demo:
228
  outputs=[motion_output_frame,motion_output_fmask,
229
  frame_output_path,fmask_output_path])
230
  videoProcess_button.click(plot_number,outputs=figure_number_output,every=2)
 
231
 
232
  demo.queue()#当有多个请求时,排队
233
  demo.launch()#生成内网链接,如需要公网链接,括号内输入share=True
 
170
  cap.release()#释放
171
  return video_save_path,video_save_path,number_of_people
172
 
173
+ #人流量显示
174
+ def change_total_visible(value):
175
+ if value == True:
176
+ return gr.update(visible = True)
177
+ if value == False:
178
+ return gr.update(visible = False)
179
 
180
  #WebUi图形界面(block)
181
  with gr.Blocks() as demo:
 
195
  text_output = gr.Video()
196
  text_output_path = gr.Text(label="输出路径")
197
  total_ID = gr.Text(label="总人数")
198
+ total_visible = gr.Checkbox(label="显示人流量")
199
  with gr.Row():
200
  with gr.Column():
201
  figure_number_output = gr.Plot(label="人流量")
 
235
  outputs=[motion_output_frame,motion_output_fmask,
236
  frame_output_path,fmask_output_path])
237
  videoProcess_button.click(plot_number,outputs=figure_number_output,every=2)
238
+ total_visible.change(change_total_visible,total_visible, figure_number_output )
239
 
240
  demo.queue()#当有多个请求时,排队
241
  demo.launch()#生成内网链接,如需要公网链接,括号内输入share=True