Spaces:
Runtime error
Runtime error
Commit
·
9ba7395
1
Parent(s):
b1f1a47
Update app.py
Browse files
app.py
CHANGED
@@ -12,17 +12,11 @@ import requests
|
|
12 |
from huggingface_hub import login
|
13 |
|
14 |
import os
|
15 |
-
|
16 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
17 |
|
18 |
|
19 |
|
20 |
-
AUTH_TOKEN = os.environ["AUTH_TOKEN"]
|
21 |
-
|
22 |
-
login(token=AUTH_TOKEN)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
|
27 |
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
28 |
|
@@ -34,13 +28,15 @@ IPpipe = StableDiffusionInpaintPipeline.from_pretrained(
|
|
34 |
IPmodel_path,
|
35 |
revision="fp16",
|
36 |
torch_dtype=torch.float16,
|
|
|
|
|
37 |
).to(device)
|
38 |
|
39 |
trans_tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
40 |
trans_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
|
41 |
|
42 |
|
43 |
-
SDpipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16, use_auth_token=
|
44 |
|
45 |
|
46 |
def create_mask(image, prompt):
|
@@ -89,7 +85,6 @@ def generate_image(image, product_name, target_name):
|
|
89 |
mask_image=mask,
|
90 |
guidance_scale=guidance_scale,
|
91 |
generator=generator,
|
92 |
-
num_images_per_prompt=num_samples,
|
93 |
).images
|
94 |
|
95 |
return im
|
|
|
12 |
from huggingface_hub import login
|
13 |
|
14 |
import os
|
15 |
+
import streamlit as st
|
16 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
17 |
|
18 |
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
|
21 |
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
22 |
|
|
|
28 |
IPmodel_path,
|
29 |
revision="fp16",
|
30 |
torch_dtype=torch.float16,
|
31 |
+
use_auth_token=st.secrets["AUTH_TOKEN"],
|
32 |
+
num_images_per_prompt=num_samples,
|
33 |
).to(device)
|
34 |
|
35 |
trans_tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
36 |
trans_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
|
37 |
|
38 |
|
39 |
+
SDpipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16, use_auth_token=st.secrets["AUTH_TOKEN"]).to(device)
|
40 |
|
41 |
|
42 |
def create_mask(image, prompt):
|
|
|
85 |
mask_image=mask,
|
86 |
guidance_scale=guidance_scale,
|
87 |
generator=generator,
|
|
|
88 |
).images
|
89 |
|
90 |
return im
|