Spaces:
Runtime error
Runtime error
DiningSystem
commited on
Commit
•
0d4f8b2
1
Parent(s):
783ed72
Update app.py
Browse files
app.py
CHANGED
@@ -3,13 +3,13 @@ from diffusers import StableDiffusionPipeline
|
|
3 |
import torch
|
4 |
|
5 |
#remember to login with token before loading model
|
6 |
-
def text_to_hair(prompt,
|
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]
|
11 |
-
image.save(save_name) #comment if don't want to save image
|
12 |
return image #PIL format
|
13 |
|
14 |
-
demo = gr.Interface(fn=
|
15 |
demo.launch()
|
|
|
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]
|
11 |
+
#image.save(save_name) #comment if don't want to save image
|
12 |
return image #PIL format
|
13 |
|
14 |
+
demo = gr.Interface(fn=text_to_hair, inputs="text", outputs="image")
|
15 |
demo.launch()
|