haakohu commited on
Commit
c86b476
1 Parent(s): 55af1da

Update gradio_demos/modules.py

Browse files
Files changed (1) hide show
  1. gradio_demos/modules.py +5 -2
gradio_demos/modules.py CHANGED
@@ -190,10 +190,13 @@ class WebcamDemo:
190
 
191
  class ExampleDemo(WebcamDemo):
192
 
193
- def __init__(self, anonymizer) -> None:
194
  self.anonymizer = anonymizer
 
 
 
195
  with gradio.Row():
196
- input_image = gradio.Image(type="pil", source="webcam")
197
  output_image = gradio.Image(type="numpy", label="Output")
198
  with gradio.Row():
199
  update_btn = gradio.Button("Update Anonymization").style(full_width=True)
 
190
 
191
  class ExampleDemo(WebcamDemo):
192
 
193
+ def __init__(self, anonymizer, source="webcam") -> None:
194
  self.anonymizer = anonymizer
195
+ kwargs = dict(source=source)
196
+ if source is None:
197
+ kwargs.pop(source)
198
  with gradio.Row():
199
+ input_image = gradio.Image(type="pil", **kwargs)
200
  output_image = gradio.Image(type="numpy", label="Output")
201
  with gradio.Row():
202
  update_btn = gradio.Button("Update Anonymization").style(full_width=True)