ttoosi commited on
Commit
5bbee37
·
verified ·
1 Parent(s): 6c7d204

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -6,16 +6,18 @@ import os
6
  import argparse
7
  from inference import GenerativeInferenceModel, get_inference_configs
8
 
 
 
 
 
 
 
9
  # Parse command line arguments
10
  parser = argparse.ArgumentParser(description='Run Generative Inference Demo')
11
- parser.add_argument('--port', type=int, default=7860, help='Port to run the server on')
12
  args = parser.parse_args()
13
 
14
- # Check if running on Hugging Face Spaces (using 'SPACE_ID' as an example environment variable)
15
- if "SPACE_ID" in os.environ:
16
- default_port = int(os.environ.get("PORT", 7860)) # Use provided PORT or fallback to 7860
17
- else:
18
- default_port = 8861 # Local default port
19
 
20
 
21
  # try:
 
6
  import argparse
7
  from inference import GenerativeInferenceModel, get_inference_configs
8
 
9
+ # Check if running on Hugging Face Spaces (using 'SPACE_ID' as an example environment variable)
10
+ if "SPACE_ID" in os.environ:
11
+ default_port = int(os.environ.get("PORT", 8860)) # Use provided PORT or fallback to 7860
12
+ else:
13
+ default_port = 7860 # Local default port
14
+
15
  # Parse command line arguments
16
  parser = argparse.ArgumentParser(description='Run Generative Inference Demo')
17
+ parser.add_argument('--port', type=int, default=default_port, help='Port to run the server on')
18
  args = parser.parse_args()
19
 
20
+
 
 
 
 
21
 
22
 
23
  # try: