Spaces:
Menyu
/
Running on Zero

Menyu commited on
Commit
ea8e426
1 Parent(s): 625830f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -35,8 +35,8 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
35
  seed = random.randint(0, MAX_SEED)
36
  return seed
37
 
38
- @spaces.GPU(queue=False,duration=30)
39
- def generate(
40
  prompt: str,
41
  negative_prompt: str = "",
42
  use_negative_prompt: bool = False,
@@ -49,7 +49,6 @@ def generate(
49
  use_resolution_binning: bool = True,
50
  progress=gr.Progress(track_tqdm=True),
51
  ):
52
- pipe.to(device)
53
  seed = int(randomize_seed_fn(seed, randomize_seed))
54
  generator = torch.Generator().manual_seed(seed)
55
  image = pipe(
@@ -148,7 +147,7 @@ with gr.Blocks(css=css) as demo:
148
  examples=examples,
149
  inputs=prompt,
150
  outputs=[result, seed],
151
- fn=generate,
152
  cache_examples=CACHE_EXAMPLES,
153
  )
154
 
@@ -164,7 +163,7 @@ with gr.Blocks(css=css) as demo:
164
  negative_prompt.submit,
165
  run_button.click,
166
  ],
167
- fn=generate,
168
  inputs=[
169
  prompt,
170
  negative_prompt,
 
35
  seed = random.randint(0, MAX_SEED)
36
  return seed
37
 
38
+ @spaces.GPU
39
+ def infer(
40
  prompt: str,
41
  negative_prompt: str = "",
42
  use_negative_prompt: bool = False,
 
49
  use_resolution_binning: bool = True,
50
  progress=gr.Progress(track_tqdm=True),
51
  ):
 
52
  seed = int(randomize_seed_fn(seed, randomize_seed))
53
  generator = torch.Generator().manual_seed(seed)
54
  image = pipe(
 
147
  examples=examples,
148
  inputs=prompt,
149
  outputs=[result, seed],
150
+ fn=infer,
151
  cache_examples=CACHE_EXAMPLES,
152
  )
153
 
 
163
  negative_prompt.submit,
164
  run_button.click,
165
  ],
166
+ fn=infer,
167
  inputs=[
168
  prompt,
169
  negative_prompt,