Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ img_pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
|
| 27 |
)
|
| 28 |
img_pipe.to(device)
|
| 29 |
|
| 30 |
-
source_img = gr.Image(
|
| 31 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[1], height="auto")
|
| 32 |
|
| 33 |
def resize(value,img):
|
|
@@ -39,14 +39,6 @@ def resize(value,img):
|
|
| 39 |
img = img.resize((value,value), Image.Resampling.LANCZOS)
|
| 40 |
return img
|
| 41 |
|
| 42 |
-
def process_sketch(input_data):
|
| 43 |
-
# input_data is a dict with "image" and "mask" keys
|
| 44 |
-
image = input_data["image"]
|
| 45 |
-
mask = input_data["mask"]
|
| 46 |
-
|
| 47 |
-
# Example: return the mask to show it works
|
| 48 |
-
return mask
|
| 49 |
-
|
| 50 |
def infer(source_img, prompt, guide, steps, seed, strength):
|
| 51 |
generator = torch.Generator("cpu").manual_seed(seed)
|
| 52 |
|
|
|
|
| 27 |
)
|
| 28 |
img_pipe.to(device)
|
| 29 |
|
| 30 |
+
source_img = gr.Image(sources=["upload", "webcam", "clipboard"], type="filepath", label="Add Image for Text Guided Editing and Sketch")
|
| 31 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[1], height="auto")
|
| 32 |
|
| 33 |
def resize(value,img):
|
|
|
|
| 39 |
img = img.resize((value,value), Image.Resampling.LANCZOS)
|
| 40 |
return img
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def infer(source_img, prompt, guide, steps, seed, strength):
|
| 43 |
generator = torch.Generator("cpu").manual_seed(seed)
|
| 44 |
|