Add an optional flag to easily control whether Gradio is enabled

#1
by heyodai - opened
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  #!/usr/bin/env python
2
 
3
  import os
 
4
 
5
  import gradio as gr
6
  import torch
@@ -27,4 +28,9 @@ with gr.Blocks(css="style.css") as demo:
27
  demo_stylization.render()
28
 
29
  if __name__ == "__main__":
30
- demo.queue(max_size=20).launch()
 
 
 
 
 
 
1
  #!/usr/bin/env python
2
 
3
  import os
4
+ import argparse
5
 
6
  import gradio as gr
7
  import torch
 
28
  demo_stylization.render()
29
 
30
  if __name__ == "__main__":
31
+ parser = argparse.ArgumentParser()
32
+ parser.add_argument("--share", action="store_true", description="Share the app via Gradio")
33
+ args = parser.parse_args()
34
+
35
+ share = True if args.share else False
36
+ demo.queue(max_size=20).launch(share=share)