phenomenon1981 commited on
Commit
e36c083
1 Parent(s): 4ade8f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -8,27 +8,23 @@ import time
8
  from queue import Queue
9
  from threading import Thread
10
 
11
- def reset_script_periodically():
12
- start_time = time.time()
13
- while True:
14
- if time.time() - start_time > 60: # 300 seconds = 5 minutes
15
- os.system("python app.py")
16
-
17
-
18
-
19
  queue = Queue()
20
  queue_threshold = 15
21
 
22
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
23
- proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
24
 
25
  def reset_queue_periodically():
26
  start_time = time.time()
27
  while True:
28
- if time.time() - start_time > 300: # 300 seconds = 5 minutes
29
  queue.queue.clear()
30
  start_time = time.time()
31
 
 
 
 
 
32
  def add_random_noise(prompt, noise_level=0.07):
33
  # Get the percentage of characters to add as noise
34
  percentage_noise = noise_level * 5
 
8
  from queue import Queue
9
  from threading import Thread
10
 
 
 
 
 
 
 
 
 
11
  queue = Queue()
12
  queue_threshold = 15
13
 
14
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
15
+ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
16
 
17
  def reset_queue_periodically():
18
  start_time = time.time()
19
  while True:
20
+ if time.time() - start_time > 150: # 150 seconds
21
  queue.queue.clear()
22
  start_time = time.time()
23
 
24
+ reset_queue_thread = Thread(target=reset_queue_periodically)
25
+ reset_queue_thread.start()
26
+
27
+
28
  def add_random_noise(prompt, noise_level=0.07):
29
  # Get the percentage of characters to add as noise
30
  percentage_noise = noise_level * 5