Spaces:
Runtime error
Runtime error
Commit
·
20cf9af
1
Parent(s):
ac8072a
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
-
|
|
|
5 |
#remember to login with token before loading model
|
6 |
def text_to_hair(prompt, num_inference_steps=500, guidance_scale=8, model_path ="CVH-vn1210/hair-model"):
|
7 |
-
pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2",torch_dtype=torch.float16,
|
8 |
pipe.unet.load_attn_procs(model_path)
|
9 |
pipe.to("cuda")
|
10 |
image = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=8).images[0]
|
|
|
1 |
import gradio as gr
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
+
import huggingface_hub as hf
|
5 |
+
hf.login(token="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")
|
6 |
#remember to login with token before loading model
|
7 |
def text_to_hair(prompt, num_inference_steps=500, guidance_scale=8, model_path ="CVH-vn1210/hair-model"):
|
8 |
+
pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2", torch_dtype=torch.float16, use_auth_token=True)
|
9 |
pipe.unet.load_attn_procs(model_path)
|
10 |
pipe.to("cuda")
|
11 |
image = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=8).images[0]
|