Spaces:
Runtime error
Runtime error
Commit Β·
01868e3
1
Parent(s): 674109e
update: minor changes
Browse files
app.py
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
import torch
|
| 2 |
-
from diffusers import StableDiffusionPipeline, StableDiffusionInpaintPipeline
|
| 3 |
-
import os
|
| 4 |
-
import gradio as gr
|
| 5 |
-
import numpy as np
|
| 6 |
-
from PIL import Image
|
| 7 |
-
from PIL.ImageOps import grayscale
|
| 8 |
import cv2
|
| 9 |
import torch
|
| 10 |
import gc
|
| 11 |
import math
|
| 12 |
import cvzone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
from cvzone.PoseModule import PoseDetector
|
| 14 |
from cvzone.FaceMeshModule import FaceMeshDetector
|
| 15 |
-
import
|
|
|
|
| 16 |
|
| 17 |
class NecklaceTryOn:
|
| 18 |
def __init__(self):
|
|
@@ -31,7 +32,7 @@ class NecklaceTryOn:
|
|
| 31 |
def clear_func(self):
|
| 32 |
torch.cuda.empty_cache()
|
| 33 |
gc.collect()
|
| 34 |
-
|
| 35 |
@spaces.GPU
|
| 36 |
def apply_necklace(self, image, jewellery):
|
| 37 |
"""Apply necklace on the image and return modified image and mask."""
|
|
@@ -163,7 +164,8 @@ class NecklaceTryOn:
|
|
| 163 |
|
| 164 |
submit = gr.Button("Apply")
|
| 165 |
|
| 166 |
-
submit.click(fn=self.clothing_try_on_n_necklace_try_on, inputs=[inputImage, selectedNecklace],
|
|
|
|
| 167 |
|
| 168 |
interface.launch(debug=True)
|
| 169 |
|
|
|
|
| 1 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import cv2
|
| 3 |
import torch
|
| 4 |
import gc
|
| 5 |
import math
|
| 6 |
import cvzone
|
| 7 |
+
import os
|
| 8 |
+
import spaces
|
| 9 |
+
import gradio as gr
|
| 10 |
+
import numpy as np
|
| 11 |
+
from PIL import Image
|
| 12 |
+
from PIL.ImageOps import grayscale
|
| 13 |
from cvzone.PoseModule import PoseDetector
|
| 14 |
from cvzone.FaceMeshModule import FaceMeshDetector
|
| 15 |
+
from diffusers import StableDiffusionInpaintPipeline
|
| 16 |
+
|
| 17 |
|
| 18 |
class NecklaceTryOn:
|
| 19 |
def __init__(self):
|
|
|
|
| 32 |
def clear_func(self):
|
| 33 |
torch.cuda.empty_cache()
|
| 34 |
gc.collect()
|
| 35 |
+
|
| 36 |
@spaces.GPU
|
| 37 |
def apply_necklace(self, image, jewellery):
|
| 38 |
"""Apply necklace on the image and return modified image and mask."""
|
|
|
|
| 164 |
|
| 165 |
submit = gr.Button("Apply")
|
| 166 |
|
| 167 |
+
submit.click(fn=self.clothing_try_on_n_necklace_try_on, inputs=[inputImage, selectedNecklace],
|
| 168 |
+
outputs=[outputOne])
|
| 169 |
|
| 170 |
interface.launch(debug=True)
|
| 171 |
|