Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,6 +48,9 @@ def load_pipeline():
|
|
| 48 |
return editor_pipeline
|
| 49 |
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
def set_env(seed=0):
|
| 52 |
torch.manual_seed(seed)
|
| 53 |
torch.set_grad_enabled(False)
|
|
@@ -67,11 +70,8 @@ def generate_img(
|
|
| 67 |
scale,
|
| 68 |
image_guidance_scale,
|
| 69 |
seed,
|
| 70 |
-
|
| 71 |
):
|
| 72 |
-
# FIXME
|
| 73 |
-
pipeline = load_pipeline()
|
| 74 |
-
|
| 75 |
# pipeline.pipe.to("cuda").to(pipeline.weight_dtype)
|
| 76 |
|
| 77 |
pil_image = PILImage.fromarray(np_image)
|
|
@@ -96,14 +96,13 @@ if __name__ == "__main__":
|
|
| 96 |
image_dir = pathlib.Path('images')
|
| 97 |
examples = [[path.as_posix(), "let this case swim in the river", 20, 4.5, 1.2, 42] for path in sorted(image_dir.glob('*.png'))]
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
)
|
| 104 |
|
| 105 |
demo = gr.Interface(
|
| 106 |
-
fn=
|
| 107 |
inputs=[
|
| 108 |
gr.Image(label="Input", type="numpy"),
|
| 109 |
Textbox(label="Prompt", placeholder="Please enter your prompt. \n"),
|
|
|
|
| 48 |
return editor_pipeline
|
| 49 |
|
| 50 |
|
| 51 |
+
pipeline = load_pipeline()
|
| 52 |
+
|
| 53 |
+
|
| 54 |
def set_env(seed=0):
|
| 55 |
torch.manual_seed(seed)
|
| 56 |
torch.set_grad_enabled(False)
|
|
|
|
| 70 |
scale,
|
| 71 |
image_guidance_scale,
|
| 72 |
seed,
|
| 73 |
+
progress=gr.Progress(track_tqdm=True),
|
| 74 |
):
|
|
|
|
|
|
|
|
|
|
| 75 |
# pipeline.pipe.to("cuda").to(pipeline.weight_dtype)
|
| 76 |
|
| 77 |
pil_image = PILImage.fromarray(np_image)
|
|
|
|
| 96 |
image_dir = pathlib.Path('images')
|
| 97 |
examples = [[path.as_posix(), "let this case swim in the river", 20, 4.5, 1.2, 42] for path in sorted(image_dir.glob('*.png'))]
|
| 98 |
|
| 99 |
+
# generate_fn = partial(
|
| 100 |
+
# generate_img,
|
| 101 |
+
# pipeline=editor_pipeline
|
| 102 |
+
# )
|
|
|
|
| 103 |
|
| 104 |
demo = gr.Interface(
|
| 105 |
+
fn=generate_img,
|
| 106 |
inputs=[
|
| 107 |
gr.Image(label="Input", type="numpy"),
|
| 108 |
Textbox(label="Prompt", placeholder="Please enter your prompt. \n"),
|