Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,18 +40,18 @@ def set_global_seed(seed: int = 42):
|
|
| 40 |
def randomize_seed_fn(seed: int, randomize: bool) -> int:
|
| 41 |
return random.randint(0, MAX_SEED) if randomize else seed
|
| 42 |
|
| 43 |
-
@spaces.GPU
|
| 44 |
def process_txt_to_img(prompt: str, height: int, width: int, steps: int, final_seed: int, guidance_scale: float, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> list[Image.Image]:
|
| 45 |
set_global_seed(final_seed)
|
| 46 |
images = pipe_t2i(model, prompt, height, width, steps, cfg=guidance_scale, seed=final_seed)
|
| 47 |
return images
|
| 48 |
|
| 49 |
-
@spaces.GPU
|
| 50 |
def process_img_to_txt(prompt: str, img: Image.Image, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> str:
|
| 51 |
output_text = pipe_txt_gen(model, img, prompt)
|
| 52 |
return output_text
|
| 53 |
|
| 54 |
-
@spaces.GPU
|
| 55 |
def process_img_txt_to_img(prompt: str, img: Image.Image, steps: int, final_seed: int, txt_cfg: float, img_cfg: float, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> list[Image.Image]:
|
| 56 |
set_global_seed(final_seed)
|
| 57 |
images = pipe_img_edit(model, img, prompt, steps, txt_cfg, img_cfg, seed=final_seed)
|
|
|
|
| 40 |
def randomize_seed_fn(seed: int, randomize: bool) -> int:
|
| 41 |
return random.randint(0, MAX_SEED) if randomize else seed
|
| 42 |
|
| 43 |
+
@spaces.GPU(duration=20)
|
| 44 |
def process_txt_to_img(prompt: str, height: int, width: int, steps: int, final_seed: int, guidance_scale: float, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> list[Image.Image]:
|
| 45 |
set_global_seed(final_seed)
|
| 46 |
images = pipe_t2i(model, prompt, height, width, steps, cfg=guidance_scale, seed=final_seed)
|
| 47 |
return images
|
| 48 |
|
| 49 |
+
@spaces.GPU(duration=20)
|
| 50 |
def process_img_to_txt(prompt: str, img: Image.Image, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> str:
|
| 51 |
output_text = pipe_txt_gen(model, img, prompt)
|
| 52 |
return output_text
|
| 53 |
|
| 54 |
+
@spaces.GPU(duration=20)
|
| 55 |
def process_img_txt_to_img(prompt: str, img: Image.Image, steps: int, final_seed: int, txt_cfg: float, img_cfg: float, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> list[Image.Image]:
|
| 56 |
set_global_seed(final_seed)
|
| 57 |
images = pipe_img_edit(model, img, prompt, steps, txt_cfg, img_cfg, seed=final_seed)
|