Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 1 |
-
|
| 2 |
import sys
|
| 3 |
sys.path.append('./ControlNetInpaint/')
|
| 4 |
from ultralytics import YOLO
|
| 5 |
from PIL import Image
|
| 6 |
import gradio as gr
|
| 7 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from diffusers import StableDiffusionInpaintPipeline, ControlNetModel, UniPCMultistepScheduler
|
| 9 |
from diffusers.utils import load_image
|
|
|
|
| 10 |
pipe_sd = StableDiffusionInpaintPipeline.from_pretrained(
|
| 11 |
"runwayml/stable-diffusion-inpainting",
|
| 12 |
revision="fp16",
|
|
@@ -29,11 +35,8 @@ text_prompt="Transform this image into a work of art by changing its style and c
|
|
| 29 |
import os
|
| 30 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
| 31 |
#pipe.to('cuda')
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
import numpy as np
|
| 35 |
-
import torch
|
| 36 |
-
from matplotlib import pyplot as plt
|
| 37 |
def image_enhance(image, mask):
|
| 38 |
image = np.array(image)
|
| 39 |
mask_image = np.array(mask)
|
|
|
|
| 1 |
+
import torch
|
| 2 |
import sys
|
| 3 |
sys.path.append('./ControlNetInpaint/')
|
| 4 |
from ultralytics import YOLO
|
| 5 |
from PIL import Image
|
| 6 |
import gradio as gr
|
| 7 |
import numpy as np
|
| 8 |
+
import os
|
| 9 |
+
import cv2
|
| 10 |
+
from PIL import Image
|
| 11 |
+
|
| 12 |
+
from matplotlib import pyplot as plt
|
| 13 |
from diffusers import StableDiffusionInpaintPipeline, ControlNetModel, UniPCMultistepScheduler
|
| 14 |
from diffusers.utils import load_image
|
| 15 |
+
|
| 16 |
pipe_sd = StableDiffusionInpaintPipeline.from_pretrained(
|
| 17 |
"runwayml/stable-diffusion-inpainting",
|
| 18 |
revision="fp16",
|
|
|
|
| 35 |
import os
|
| 36 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
| 37 |
#pipe.to('cuda')
|
| 38 |
+
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
| 40 |
def image_enhance(image, mask):
|
| 41 |
image = np.array(image)
|
| 42 |
mask_image = np.array(mask)
|