Alex Volkov commited on
Commit
7ce50df
1 Parent(s): 8d6dff7

ports ports ports

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. utils/apis.py +3 -2
app.py CHANGED
@@ -115,5 +115,5 @@ def temp():
115
 
116
  if __name__ == "__main__":
117
  gradio.close_all()
118
- port = os.environ.get('GRADIO_SERVER_PORT', 8111)
119
- demo.launch(show_error=True, debug=True, share=gradio_share, favicon_path='fonts/icon.png')
 
115
 
116
  if __name__ == "__main__":
117
  gradio.close_all()
118
+ port = os.environ.get('SERVER_PORT', 8111)
119
+ demo.launch(show_error=True, debug=True, share=gradio_share,server_port=int(port), favicon_path='fonts/icon.png')
utils/apis.py CHANGED
@@ -8,15 +8,16 @@ from shutil import rmtree
8
 
9
  import anvil.server
10
  import anvil.media
 
11
  import gradio as gr
12
  import requests
13
-
14
  from download import download_generator
15
 
16
 
 
17
  @anvil.server.callable
18
  def call_gradio_api(api_name='test_api', data=()):
19
- port = os.environ.get('GRADIO_SERVER_PORT', 8111)
20
  gradio_base_url = os.environ.get('GRADIO_URL', f'http://127.0.0.1:{port}/api/')
21
  gradio_url = f"{gradio_base_url}{api_name}"
22
  payload = json.dumps({"data": data})
 
8
 
9
  import anvil.server
10
  import anvil.media
11
+ import dotenv
12
  import gradio as gr
13
  import requests
 
14
  from download import download_generator
15
 
16
 
17
+ dotenv.load_dotenv()
18
  @anvil.server.callable
19
  def call_gradio_api(api_name='test_api', data=()):
20
+ port = os.environ.get('SERVER_PORT', 8111)
21
  gradio_base_url = os.environ.get('GRADIO_URL', f'http://127.0.0.1:{port}/api/')
22
  gradio_url = f"{gradio_base_url}{api_name}"
23
  payload = json.dumps({"data": data})