Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -14,7 +14,7 @@ def generate_story(prompt, duration):
|
|
| 14 |
text = tokenizer(
|
| 15 |
f"Write a detailed story of {duration} minutes about: {prompt}",
|
| 16 |
return_tensors="pt"
|
| 17 |
-
).to("
|
| 18 |
|
| 19 |
output = model.generate(**text, max_new_tokens=900)
|
| 20 |
story = tokenizer.decode(output[0], skip_special_tokens=True)
|
|
@@ -37,7 +37,7 @@ def generate_images(story):
|
|
| 37 |
sd = StableDiffusionPipeline.from_pretrained(
|
| 38 |
"runwayml/stable-diffusion-v1-5",
|
| 39 |
torch_dtype=torch.float16
|
| 40 |
-
).to("
|
| 41 |
|
| 42 |
scenes = story.split(".")[:10] # create 10 images max
|
| 43 |
paths = []
|
|
|
|
| 14 |
text = tokenizer(
|
| 15 |
f"Write a detailed story of {duration} minutes about: {prompt}",
|
| 16 |
return_tensors="pt"
|
| 17 |
+
).to("cpu")
|
| 18 |
|
| 19 |
output = model.generate(**text, max_new_tokens=900)
|
| 20 |
story = tokenizer.decode(output[0], skip_special_tokens=True)
|
|
|
|
| 37 |
sd = StableDiffusionPipeline.from_pretrained(
|
| 38 |
"runwayml/stable-diffusion-v1-5",
|
| 39 |
torch_dtype=torch.float16
|
| 40 |
+
).to("cpu")
|
| 41 |
|
| 42 |
scenes = story.split(".")[:10] # create 10 images max
|
| 43 |
paths = []
|