phenomenon1981 commited on
Commit
4b86536
1 Parent(s): 3291aee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -15,11 +15,12 @@ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
15
 
16
  def restart_script_periodically():
17
  while True:
18
- time.sleep(600) # 10 minutes
19
- try:
20
- os.execl(sys.executable, sys.executable, *sys.argv)
21
- except:
22
- pass
 
23
 
24
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
25
  restart_thread.start()
 
15
 
16
  def restart_script_periodically():
17
  while True:
18
+ time.sleep(60) # 10 minutes
19
+ devnull = open(os.devnull, 'w')
20
+ sys.stdout = devnull
21
+ sys.stderr = devnull
22
+ os.execl(sys.executable, sys.executable, *sys.argv)
23
+ devnull.close()
24
 
25
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
26
  restart_thread.start()