lllyasviel commited on
Commit
bb33d1a
1 Parent(s): 292a26b

1.0.25 (#67)

Browse files

support sys.argv --listen --share --port

Files changed (5) hide show
  1. fooocus_version.py +1 -1
  2. launch.py +8 -1
  3. modules/async_worker.py +4 -1
  4. update_log.md +4 -0
  5. webui.py +8 -1
fooocus_version.py CHANGED
@@ -1 +1 @@
1
- version = '1.0.24'
 
1
+ version = '1.0.25'
launch.py CHANGED
@@ -72,9 +72,16 @@ def download_models():
72
  return
73
 
74
 
 
 
 
 
 
 
 
75
  prepare_environment()
76
 
77
- import cuda_malloc
78
 
79
  download_models()
80
 
 
72
  return
73
 
74
 
75
+ def cuda_malloc():
76
+ argv = sys.argv
77
+ sys.argv = [sys.argv[0]]
78
+ import cuda_malloc
79
+ sys.argv = argv
80
+
81
+
82
  prepare_environment()
83
 
84
+ cuda_malloc()
85
 
86
  download_models()
87
 
modules/async_worker.py CHANGED
@@ -21,7 +21,10 @@ def worker():
21
 
22
  try:
23
  async_gradio_app = shared.gradio_root
24
- print(f'''App started successful. Use the app with {str(async_gradio_app.local_url)} or {str(async_gradio_app.server_name)}:{str(async_gradio_app.server_port)}''')
 
 
 
25
  except Exception as e:
26
  print(e)
27
 
 
21
 
22
  try:
23
  async_gradio_app = shared.gradio_root
24
+ flag = f'''App started successful. Use the app with {str(async_gradio_app.local_url)} or {str(async_gradio_app.server_name)}:{str(async_gradio_app.server_port)}'''
25
+ if async_gradio_app.share:
26
+ flag += f''' or {async_gradio_app.share_url}'''
27
+ print(flag)
28
  except Exception as e:
29
  print(e)
30
 
update_log.md CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  ### 1.0.24
2
 
3
  * Taller input textbox.
 
1
+ ### 1.0.25
2
+
3
+ * support sys.argv --listen --share --port
4
+
5
  ### 1.0.24
6
 
7
  * Taller input textbox.
webui.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import sys
3
  import time
4
  import shared
 
5
  import modules.path
6
  import fooocus_version
7
  import modules.html
@@ -94,4 +95,10 @@ with shared.gradio_root:
94
  ctrls += [base_model, refiner_model] + lora_ctrls
95
  run_button.click(fn=generate_clicked, inputs=ctrls, outputs=[run_button, progress_html, progress_window, gallery])
96
 
97
- shared.gradio_root.launch(inbrowser=True, server_name='0.0.0.0' if '--listen' in sys.argv else None)
 
 
 
 
 
 
 
2
  import sys
3
  import time
4
  import shared
5
+ import argparse
6
  import modules.path
7
  import fooocus_version
8
  import modules.html
 
95
  ctrls += [base_model, refiner_model] + lora_ctrls
96
  run_button.click(fn=generate_clicked, inputs=ctrls, outputs=[run_button, progress_html, progress_window, gallery])
97
 
98
+
99
+ parser = argparse.ArgumentParser()
100
+ parser.add_argument("--listen", action='store_true', help="Listen remote port.")
101
+ parser.add_argument("--port", type=int, default=None, help="Set the listen port.")
102
+ parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")
103
+ args = parser.parse_args()
104
+ shared.gradio_root.launch(inbrowser=True, server_name='0.0.0.0' if args.listen else None, server_port=args.port, share=args.share)