Notes/warning on docker like environments

This commit is contained in:
erew123 authored and GitHub committed 2024-07-27 09:17:20 +01:00
1 parent 6fac1aa5f9
commit 5257497b57
1 file changed
+29 -22
+29 -22
View File
@@ -346,39 +346,46 @@ signal.signal(signal.SIGINT, signal_handler)
# Check if we're running in docker # Check if we're running in docker
if os.path.isfile("/.dockerenv") and 'google.colab' not in sys.modules: if os.path.isfile("/.dockerenv") and 'google.colab' not in sys.modules:
print(f"[{branding}TTS] \033[94mRunning in Docker. Please wait.\033[0m") print(f"[{branding}TTS] \033[94mRunning in Docker environment. Please note:\033[0m")
else: print(f"[{branding}TTS] - Docker like environments are a work in progress.")
# Start the subprocess print(f"[{branding}TTS] - On a LAN environment, as long as you expose the Gradio and API ports correctly, this should work.")
process = subprocess.Popen(["python", script_path]) print(f"[{branding}TTS] - On a routed Internet environment, a VPN to the host server OR secure tunnel will be required for")
print(f"[{branding}TTS] both addresses and additionally Gradio is yet to be re-coded to handle a custom API address, so")
print(f"[{branding}TTS] the Gradio interface will not work correctly as of yet.")
print(f"[{branding}TTS] Internal API address: http://localhost:{params['api_def']['api_port_number']}")
print(f"[{branding}TTS] Internal Gradio address: http://localhost:{params['gradio_port_number']}")
# Check if the subprocess has started successfully # Start the subprocess (now unified for both Docker and non-Docker environments)
if process.poll() is None: process = subprocess.Popen(["python", script_path])
# Check if the subprocess has started successfully
if process.poll() is None:
if running_on_google_colab: if running_on_google_colab:
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
print(f"[{branding}TTS] \033[94mGoogle Colab Detected\033[00m") print(f"[{branding}TTS] \033[94mGoogle Colab Detected\033[00m")
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
else: else:
print(f"[{branding}TTS] \033[91mWarning\033[0m TTS Subprocess Webserver failing to start process") print(f"[{branding}TTS] \033[91mWarning\033[0m TTS Subprocess Webserver failing to start process")
print(f"[{branding}TTS] \033[91mWarning\033[0m It could be that you have something on port:",params["port_number"],) print(f"[{branding}TTS] \033[91mWarning\033[0m It could be that you have something on port:", params["port_number"])
print(f"[{branding}TTS] \033[91mWarning\033[0m Or you have not started in a Python environement with all the necesssary bits installed") print(f"[{branding}TTS] \033[91mWarning\033[0m Or you have not started in a Python environment with all the necessary bits installed")
print(f"[{branding}TTS] \033[91mWarning\033[0m Check you are starting Text-generation-webui with either the start_xxxxx file or the Python environment with cmd_xxxxx file.") print(f"[{branding}TTS] \033[91mWarning\033[0m Check you are starting Text-generation-webui with either the start_xxxxx file or the Python environment with cmd_xxxxx file.")
print(f"[{branding}TTS] \033[91mWarning\033[0m xxxxx is the type of OS you are on e.g. windows, linux or mac.") print(f"[{branding}TTS] \033[91mWarning\033[0m xxxxx is the type of OS you are on e.g. windows, linux or mac.")
print(f"[{branding}TTS] \033[91mWarning\033[0m Alternatively, you could check no other Python processes are running that shouldnt be e.g. Restart your computer is the simple way.") print(f"[{branding}TTS] \033[91mWarning\033[0m Alternatively, you could check no other Python processes are running that shouldn't be e.g. Restart your computer is the simple way.")
# Cleanly kill off this script, but allow text-generation-webui to keep running, albeit without this alltalk_tts # Cleanly kill off this script, but allow text-generation-webui to keep running, albeit without this alltalk_tts
sys.exit(1) sys.exit(1)
timeout = startup_wait_time # Gather timeout setting from startup_wait_time timeout = startup_wait_time # Gather timeout setting from startup_wait_time
initial_delay = 5 # Initial delay before starting the check loop initial_delay = 5 # Initial delay before starting the check loop
warning_delay = 60 # Delay before displaying warnings warning_delay = 60 # Delay before displaying warnings
# Introduce a delay before starting the check loop # Introduce a delay before starting the check loop
time.sleep(initial_delay) time.sleep(initial_delay)
start_time = time.time() start_time = time.time()
warning_displayed = False warning_displayed = False
url = f"http://localhost:{params['api_def']['api_port_number']}/api/ready" url = f"http://localhost:{params['api_def']['api_port_number']}/api/ready"
while time.time() - start_time < timeout: while time.time() - start_time < timeout:
try: try:
response = requests.get(url) response = requests.get(url)
if response.status_code == 200 and response.text == "Ready": if response.status_code == 200 and response.text == "Ready":
@@ -395,7 +402,7 @@ else:
warning_displayed = True warning_displayed = True
time.sleep(1) time.sleep(1)
else: else:
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
print(f"[{branding}TTS] Startup timed out. Full help available here \033[92mhttps://github.com/erew123/alltalk_tts#-help-with-problems\033[0m") print(f"[{branding}TTS] Startup timed out. Full help available here \033[92mhttps://github.com/erew123/alltalk_tts#-help-with-problems\033[0m")
print(f"[{branding}TTS] On older systems, you may wish to open and edit \033[94mscript.py\033[0m with a text editor and change the") print(f"[{branding}TTS] On older systems, you may wish to open and edit \033[94mscript.py\033[0m with a text editor and change the")
@@ -405,13 +412,13 @@ else:
# Cleanly kill off this script, but allow text-generation-webui to keep running, albeit without this alltalk_tts # Cleanly kill off this script, but allow text-generation-webui to keep running, albeit without this alltalk_tts
sys.exit(1) sys.exit(1)
if running_on_google_colab: if running_on_google_colab:
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
print(f"[{branding}TTS] \033[94mAPI Address :\033[00m",f"\033[92m{tunnel_url_1}\033[00m") print(f"[{branding}TTS] \033[94mAPI Address :\033[00m",f"\033[92m{tunnel_url_1}\033[00m")
print(f"[{branding}TTS] \033[94mGradio Light:\033[00m",f"\033[92m{tunnel_url_2}\033[00m") print(f"[{branding}TTS] \033[94mGradio Light:\033[00m",f"\033[92m{tunnel_url_2}\033[00m")
print(f"[{branding}TTS] \033[94mGradio Dark :\033[00m",f"\033[92m{tunnel_url_2}?__theme=dark\033[00m") print(f"[{branding}TTS] \033[94mGradio Dark :\033[00m",f"\033[92m{tunnel_url_2}?__theme=dark\033[00m")
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
else: else:
print(f"[{branding}TTS]") print(f"[{branding}TTS]")
print(f"[{branding}TTS] \033[94mAPI Address :\033[00m",f"\033[92m127.0.0.1:{params['api_def']['api_port_number']}\033[00m") print(f"[{branding}TTS] \033[94mAPI Address :\033[00m",f"\033[92m127.0.0.1:{params['api_def']['api_port_number']}\033[00m")
print(f"[{branding}TTS] \033[94mGradio Light:\033[00m",f"\033[92mhttp://127.0.0.1:{params['gradio_port_number']}\033[00m") print(f"[{branding}TTS] \033[94mGradio Light:\033[00m",f"\033[92mhttp://127.0.0.1:{params['gradio_port_number']}\033[00m")