Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import modin.pandas as pd
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
-
|
6 |
from diffusers import DiffusionPipeline
|
7 |
from huggingface_hub import login
|
8 |
|
@@ -16,8 +16,9 @@ def resize(value,img):
|
|
16 |
return img
|
17 |
|
18 |
def infer(source_img, prompt, negative_prompt, guide, steps, seed, Strength):
|
19 |
-
generator = torch.Generator(device).manual_seed(seed)
|
20 |
-
|
|
|
21 |
image = pipe(prompt, negative_prompt=negative_prompt, image=src, strength=Strength, guidance_scale=guide, num_inference_steps=steps).images[0]
|
22 |
return image
|
23 |
|
|
|
2 |
import modin.pandas as pd
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
+
import imageio
|
6 |
from diffusers import DiffusionPipeline
|
7 |
from huggingface_hub import login
|
8 |
|
|
|
16 |
return img
|
17 |
|
18 |
def infer(source_img, prompt, negative_prompt, guide, steps, seed, Strength):
|
19 |
+
generator = torch.Generator(device).manual_seed(seed)
|
20 |
+
imageio.imwrite("data.png", source_img["image"])
|
21 |
+
src = resize(768, 'data.png')
|
22 |
image = pipe(prompt, negative_prompt=negative_prompt, image=src, strength=Strength, guidance_scale=guide, num_inference_steps=steps).images[0]
|
23 |
return image
|
24 |
|