Spaces:
Runtime error
Runtime error
rearrange functions
Browse files
app.py
CHANGED
@@ -7,17 +7,6 @@ import gradio as gr
|
|
7 |
from diffusers import StableDiffusionInpaintPipeline
|
8 |
from rembg import remove
|
9 |
|
10 |
-
def greet(name):
|
11 |
-
img_url = "https://cdn.faire.com/fastly/893b071985d70819da5f0d485f1b1bb97ee4f16a6e14ef1bdd4a086b3588be58.png" # wino
|
12 |
-
image = download_image(img_url).resize((512, 512))
|
13 |
-
inverted_mask_image = remove(data = image, only_mask = True)
|
14 |
-
mask_image = PIL.ImageOps.invert(inverted_mask_image)
|
15 |
-
|
16 |
-
return "Hello " + name + "!!"
|
17 |
-
|
18 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
19 |
-
iface.launch()
|
20 |
-
|
21 |
# def image_grid(imgs, rows, cols):
|
22 |
# assert len(imgs) == rows*cols
|
23 |
|
@@ -29,12 +18,23 @@ iface.launch()
|
|
29 |
# grid.paste(img, box=(i%cols*w, i//cols*h))
|
30 |
# return grid
|
31 |
|
32 |
-
def download_image(url):
|
33 |
-
response = requests.get(url)
|
34 |
-
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
35 |
-
|
36 |
# def predict(dict, prompt):
|
37 |
# image = dict['image'].convert("RGB").resize((512, 512))
|
38 |
# mask_image = dict['mask'].convert("RGB").resize((512, 512))
|
39 |
# images = pipe(prompt=prompt, image=image, mask_image=mask_image).images
|
40 |
-
# return(images[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
from diffusers import StableDiffusionInpaintPipeline
|
8 |
from rembg import remove
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# def image_grid(imgs, rows, cols):
|
11 |
# assert len(imgs) == rows*cols
|
12 |
|
|
|
18 |
# grid.paste(img, box=(i%cols*w, i//cols*h))
|
19 |
# return grid
|
20 |
|
|
|
|
|
|
|
|
|
21 |
# def predict(dict, prompt):
|
22 |
# image = dict['image'].convert("RGB").resize((512, 512))
|
23 |
# mask_image = dict['mask'].convert("RGB").resize((512, 512))
|
24 |
# images = pipe(prompt=prompt, image=image, mask_image=mask_image).images
|
25 |
+
# return(images[0])
|
26 |
+
|
27 |
+
def download_image(url):
|
28 |
+
response = requests.get(url)
|
29 |
+
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
30 |
+
|
31 |
+
def greet(name):
|
32 |
+
img_url = "https://cdn.faire.com/fastly/893b071985d70819da5f0d485f1b1bb97ee4f16a6e14ef1bdd4a086b3588be58.png" # wino
|
33 |
+
image = download_image(img_url).resize((512, 512))
|
34 |
+
inverted_mask_image = remove(data = image, only_mask = True)
|
35 |
+
mask_image = PIL.ImageOps.invert(inverted_mask_image)
|
36 |
+
|
37 |
+
return "Hello " + name + "!!"
|
38 |
+
|
39 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
40 |
+
iface.launch()
|