Spaces:
Runtime error
Runtime error
add trigger word
Browse files
app.py
CHANGED
@@ -19,6 +19,8 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
19 |
IMAGE_SIZE = 1024
|
20 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
21 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
|
|
|
22 |
login(token=HF_TOKEN)
|
23 |
|
24 |
def remove_background(image: Image.Image, threshold: int = 50) -> Image.Image:
|
@@ -127,7 +129,7 @@ def process(
|
|
127 |
seed_slicer = random.randint(0, MAX_SEED)
|
128 |
generator = torch.Generator().manual_seed(seed_slicer)
|
129 |
result = pipe(
|
130 |
-
prompt=input_text,
|
131 |
image=resized_image,
|
132 |
mask_image=resized_mask,
|
133 |
width=width,
|
|
|
19 |
IMAGE_SIZE = 1024
|
20 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
21 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
22 |
+
trigger_word = "a_photo_of_TOK"
|
23 |
+
|
24 |
login(token=HF_TOKEN)
|
25 |
|
26 |
def remove_background(image: Image.Image, threshold: int = 50) -> Image.Image:
|
|
|
129 |
seed_slicer = random.randint(0, MAX_SEED)
|
130 |
generator = torch.Generator().manual_seed(seed_slicer)
|
131 |
result = pipe(
|
132 |
+
prompt=f"{input_text} {trigger_word}",
|
133 |
image=resized_image,
|
134 |
mask_image=resized_mask,
|
135 |
width=width,
|