shahkushan1 commited on
Commit
c4512d1
·
1 Parent(s): 6f4b2c5

Bind Gradio to 0.0.0.0 and auto-share on Spaces

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
 
3
  import io
4
  import logging
 
5
  from pathlib import Path
6
  from typing import List
7
 
@@ -116,4 +117,8 @@ def make_interface():
116
  if __name__ == "__main__":
117
  app = make_interface()
118
  app.queue()
119
- app.launch()
 
 
 
 
 
2
 
3
  import io
4
  import logging
5
+ import os
6
  from pathlib import Path
7
  from typing import List
8
 
 
117
  if __name__ == "__main__":
118
  app = make_interface()
119
  app.queue()
120
+ app.launch(
121
+ server_name="0.0.0.0",
122
+ server_port=int(os.environ.get("PORT", 7860)),
123
+ share=bool(os.environ.get("SPACE_ID")),
124
+ )