Spaces:
Runtime error
Runtime error
georgekutty george
commited on
Commit
·
6ef0474
1
Parent(s):
22177c2
lkspace
Browse files
app.py
CHANGED
@@ -12,11 +12,12 @@ login(token=os.getenv("HF_TOKEN"))
|
|
12 |
|
13 |
# 4. Load private model using your token
|
14 |
model_id = "Lookingsoft-team/Text_to_Image_Diffusion"
|
|
|
15 |
|
16 |
pipe = StableDiffusionPipeline.from_pretrained(
|
17 |
model_id,
|
18 |
torch_dtype=torch.float16 # smaller memory
|
19 |
-
).to(
|
20 |
|
21 |
def generate_image(prompt):
|
22 |
image = pipe(prompt).images[0]
|
|
|
12 |
|
13 |
# 4. Load private model using your token
|
14 |
model_id = "Lookingsoft-team/Text_to_Image_Diffusion"
|
15 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
|
17 |
pipe = StableDiffusionPipeline.from_pretrained(
|
18 |
model_id,
|
19 |
torch_dtype=torch.float16 # smaller memory
|
20 |
+
).to(device)
|
21 |
|
22 |
def generate_image(prompt):
|
23 |
image = pipe(prompt).images[0]
|