Yaron Koresh commited on
Commit
cde99b9
·
verified ·
1 Parent(s): 8af1f7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -22,8 +22,6 @@ from diffusers.utils import load_image
22
  #import jax
23
  #import jax.numpy as jnp
24
 
25
- result=[]
26
-
27
  def port_inc():
28
  env = os.getenv("CUSTOM_PORT")
29
  if env == None:
@@ -44,9 +42,6 @@ def pipe_i2i():
44
  PIPE.unet = torch.compile(PIPE.unet, mode="reduce-overhead", fullgraph=True)
45
  return PIPE
46
 
47
- pp1=pipe_t2i()
48
- pp2=pipe_i2i()
49
-
50
  def translate(text,lang):
51
  if text == None or lang == None:
52
  return ""
@@ -94,19 +89,17 @@ def generate_random_string(length):
94
 
95
  @spaces.GPU(duration=40)
96
  def Piper1(_do):
97
- try:
98
- retu = pp1(
99
- _do,
100
- height=512,
101
- width=512,
102
- num_inference_steps=4,
103
- max_sequence_length=256,
104
- guidance_scale=0
105
- )
106
- return retu
107
- except Exception as e:
108
- print(e)
109
- return None
110
 
111
  @spaces.GPU(duration=40)
112
  def Piper2(img,posi,neg):
@@ -245,6 +238,14 @@ def ui():
245
 
246
  if __name__ == "__main__":
247
 
 
 
 
 
 
 
 
 
248
  mp.set_start_method("fork", force=True)
249
  port_inc()
250
  ui()
 
22
  #import jax
23
  #import jax.numpy as jnp
24
 
 
 
25
  def port_inc():
26
  env = os.getenv("CUSTOM_PORT")
27
  if env == None:
 
42
  PIPE.unet = torch.compile(PIPE.unet, mode="reduce-overhead", fullgraph=True)
43
  return PIPE
44
 
 
 
 
45
  def translate(text,lang):
46
  if text == None or lang == None:
47
  return ""
 
89
 
90
  @spaces.GPU(duration=40)
91
  def Piper1(_do):
92
+ print("starting piper1")
93
+ retu = pp1(
94
+ _do,
95
+ height=512,
96
+ width=512,
97
+ num_inference_steps=4,
98
+ max_sequence_length=256,
99
+ guidance_scale=0
100
+ )
101
+ print("returning piper1")
102
+ return retu
 
 
103
 
104
  @spaces.GPU(duration=40)
105
  def Piper2(img,posi,neg):
 
238
 
239
  if __name__ == "__main__":
240
 
241
+ global result
242
+ global pp1
243
+ glibal pp2
244
+
245
+ result=[]
246
+ pp1=pipe_t2i()
247
+ pp2=pipe_i2i()
248
+
249
  mp.set_start_method("fork", force=True)
250
  port_inc()
251
  ui()