Spaces:
Sleeping
Sleeping
Commit
·
656c364
1
Parent(s):
5c187de
up test 1
Browse files
app.py
CHANGED
|
@@ -71,8 +71,10 @@ def segmentation(img):
|
|
| 71 |
def upscale(image,prompt):
|
| 72 |
print("upscale")
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
| 76 |
upscaled_image = pipeline(prompt=prompt, image=image).images[0]
|
| 77 |
return upscaled_image
|
| 78 |
|
|
@@ -99,6 +101,7 @@ with gr.Blocks() as app:
|
|
| 99 |
gr.Image(),
|
| 100 |
gr.Image(),
|
| 101 |
gr.Image()])
|
|
|
|
| 102 |
with gr.Column():
|
| 103 |
gr.Button("Segmentation").click(segmentation, inputs=gr.Image(type="pil"), outputs=gr.JSON())
|
| 104 |
|
|
|
|
| 71 |
def upscale(image,prompt):
|
| 72 |
print("upscale")
|
| 73 |
|
| 74 |
+
image = Image.thumbnail((512, 512))
|
| 75 |
+
|
| 76 |
+
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-x4-upscaler")
|
| 77 |
+
# pipeline = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16).to('cuda')
|
| 78 |
upscaled_image = pipeline(prompt=prompt, image=image).images[0]
|
| 79 |
return upscaled_image
|
| 80 |
|
|
|
|
| 101 |
gr.Image(),
|
| 102 |
gr.Image(),
|
| 103 |
gr.Image()])
|
| 104 |
+
|
| 105 |
with gr.Column():
|
| 106 |
gr.Button("Segmentation").click(segmentation, inputs=gr.Image(type="pil"), outputs=gr.JSON())
|
| 107 |
|