Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,27 +4,30 @@ import sys
|
|
| 4 |
|
| 5 |
# --- Configuration ---
|
| 6 |
PORT = int(os.environ.get("PORT", 7860))
|
| 7 |
-
# Use --bind argument name instead of --host
|
| 8 |
BIND_ADDRESS = "0.0.0.0" # Listen on all interfaces within the container
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Choose the g4f install variant (ensure it matches requirements.txt)
|
| 11 |
G4F_VARIANT = "all" # Change to 'slim' or 'base' if needed
|
| 12 |
|
| 13 |
# --- --- --- --- ---
|
| 14 |
|
| 15 |
print(f"--- Starting gpt4free API Server (variant: {G4F_VARIANT}) ---")
|
| 16 |
-
print(f"Attempting to
|
| 17 |
print(f"Python version: {sys.version}")
|
| 18 |
print("-" * 30)
|
| 19 |
|
| 20 |
-
# Construct the command using --bind
|
|
|
|
| 21 |
command = [
|
| 22 |
sys.executable,
|
| 23 |
"-m",
|
| 24 |
"g4f",
|
| 25 |
-
"--bind",
|
| 26 |
-
"--port", str(PORT),
|
| 27 |
"--debug"
|
|
|
|
| 28 |
]
|
| 29 |
|
| 30 |
print(f"Executing command: {' '.join(command)}")
|
|
|
|
| 4 |
|
| 5 |
# --- Configuration ---
|
| 6 |
PORT = int(os.environ.get("PORT", 7860))
|
|
|
|
| 7 |
BIND_ADDRESS = "0.0.0.0" # Listen on all interfaces within the container
|
| 8 |
|
| 9 |
+
# Combine address and port for the --bind argument
|
| 10 |
+
COMBINED_BIND = f"{BIND_ADDRESS}:{PORT}"
|
| 11 |
+
|
| 12 |
# Choose the g4f install variant (ensure it matches requirements.txt)
|
| 13 |
G4F_VARIANT = "all" # Change to 'slim' or 'base' if needed
|
| 14 |
|
| 15 |
# --- --- --- --- ---
|
| 16 |
|
| 17 |
print(f"--- Starting gpt4free API Server (variant: {G4F_VARIANT}) ---")
|
| 18 |
+
print(f"Attempting to bind to: {COMBINED_BIND}") # Updated print statement
|
| 19 |
print(f"Python version: {sys.version}")
|
| 20 |
print("-" * 30)
|
| 21 |
|
| 22 |
+
# Construct the command using the combined --bind "<address>:<port>" format
|
| 23 |
+
# Remove the separate --port argument
|
| 24 |
command = [
|
| 25 |
sys.executable,
|
| 26 |
"-m",
|
| 27 |
"g4f",
|
| 28 |
+
"--bind", COMBINED_BIND, # Use the combined address and port string
|
|
|
|
| 29 |
"--debug"
|
| 30 |
+
# No separate --port argument needed here
|
| 31 |
]
|
| 32 |
|
| 33 |
print(f"Executing command: {' '.join(command)}")
|