Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
from PIL import Image
|
2 |
import requests
|
|
|
3 |
|
4 |
from transformers import CLIPSegProcessor, CLIPSegForImageSegmentation
|
5 |
from diffusers import DiffusionPipeline
|
6 |
import torch
|
7 |
from torch import autocast
|
8 |
|
|
|
|
|
9 |
url = "https://github.com/timojl/clipseg/blob/master/example_image.jpg?raw=true"
|
10 |
image = Image.open(requests.get(url, stream=True).raw)
|
11 |
|
@@ -16,7 +19,8 @@ pipe = DiffusionPipeline.from_pretrained(
|
|
16 |
"runwayml/stable-diffusion-inpainting",
|
17 |
custom_pipeline="text_inpainting",
|
18 |
segmentation_model=model,
|
19 |
-
segmentation_processor=processor
|
|
|
20 |
)
|
21 |
|
22 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
1 |
from PIL import Image
|
2 |
import requests
|
3 |
+
import os
|
4 |
|
5 |
from transformers import CLIPSegProcessor, CLIPSegForImageSegmentation
|
6 |
from diffusers import DiffusionPipeline
|
7 |
import torch
|
8 |
from torch import autocast
|
9 |
|
10 |
+
auth_token = os.environ.get("API_TOKEN") or True
|
11 |
+
|
12 |
url = "https://github.com/timojl/clipseg/blob/master/example_image.jpg?raw=true"
|
13 |
image = Image.open(requests.get(url, stream=True).raw)
|
14 |
|
|
|
19 |
"runwayml/stable-diffusion-inpainting",
|
20 |
custom_pipeline="text_inpainting",
|
21 |
segmentation_model=model,
|
22 |
+
segmentation_processor=processor,
|
23 |
+
use_auth_token=auth_token,
|
24 |
)
|
25 |
|
26 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|