Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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=
|
| 12 |
args = parser.parse_args()
|
| 13 |
|
| 14 |
-
|
| 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:
|