Spaces:
Runtime error
Runtime error
app.py
CHANGED
@@ -14,7 +14,7 @@ print(f"device is :{device}")
|
|
14 |
# init stable diffusion model
|
15 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=th.float32, use_auth_token= HF_TOKEN).to(device) #revision="fp16",
|
16 |
|
17 |
-
def
|
18 |
scale=7.5
|
19 |
steps=45
|
20 |
with autocast('cpu' if not th.cuda.is_available() else 'cuda'):
|
@@ -27,12 +27,12 @@ def get_sd(translated_txt):
|
|
27 |
#headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
28 |
sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion", use_auth_token=HF_TOKEN )#'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')
|
29 |
|
30 |
-
def
|
31 |
print("******** Inside get_SD ********")
|
32 |
print(f"translated_txt is : {translated_txt}")
|
33 |
#sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion", use_auth_token='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')
|
34 |
print(f"stable Diff inf is : {sd_inf}")
|
35 |
-
sd_img_gallery = sd_inf([translated_txt, 4,45, 7.5,1024], fn_index=
|
36 |
|
37 |
return sd_img_gallery[0]
|
38 |
|
|
|
14 |
# init stable diffusion model
|
15 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=th.float32, use_auth_token= HF_TOKEN).to(device) #revision="fp16",
|
16 |
|
17 |
+
def get_sd_old(translated_txt):
|
18 |
scale=7.5
|
19 |
steps=45
|
20 |
with autocast('cpu' if not th.cuda.is_available() else 'cuda'):
|
|
|
27 |
#headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
28 |
sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion", use_auth_token=HF_TOKEN )#'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')
|
29 |
|
30 |
+
def get_sd(translated_txt):
|
31 |
print("******** Inside get_SD ********")
|
32 |
print(f"translated_txt is : {translated_txt}")
|
33 |
#sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion", use_auth_token='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')
|
34 |
print(f"stable Diff inf is : {sd_inf}")
|
35 |
+
sd_img_gallery = sd_inf([translated_txt, 4,45, 7.5,1024], fn_index=2)[0] #(prompt, samples, steps, scale, seed) #translated_txt
|
36 |
|
37 |
return sd_img_gallery[0]
|
38 |
|