File size: 647 Bytes
ef9fd1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import time


def relaunch_process(launch_counter=0):
    '''

    '''
    while launch_counter < 1:
        print('Relauncher: Launching...')
        if launch_counter > 0:
            print(f'\tRelaunch count: {launch_counter}')

        try:
            launch_string = "/workspace/stable-diffusion-webui/webui.sh -f"
            os.system(launch_string)
        except Exception as err:
            print(f"An error occurred: {err}")
        finally:
            print('Relauncher: Process is ending. Relaunching in 2s...')
            launch_counter += 1
            time.sleep(2)


if __name__ == "__main__":
    relaunch_process()