Spaces:
Runtime error
Runtime error
add image_size_coef to change image size
Browse files- src/constructor.py +4 -1
src/constructor.py
CHANGED
|
@@ -27,6 +27,7 @@ def generate_presentation(
|
|
| 27 |
font:Font,
|
| 28 |
output_dir: str,
|
| 29 |
num_inference_steps: int,
|
|
|
|
| 30 |
) -> Presentation:
|
| 31 |
"""
|
| 32 |
Generate a PowerPoint presentation based on a description using language and image models.
|
|
@@ -78,6 +79,7 @@ def generate_presentation(
|
|
| 78 |
image_width, image_height = random.choice(
|
| 79 |
[(768, 1344), (1024, 1024)]
|
| 80 |
)
|
|
|
|
| 81 |
caption_prompt = llm_generate_image_prompt(
|
| 82 |
llm_generate,
|
| 83 |
description,
|
|
@@ -101,7 +103,8 @@ def generate_presentation(
|
|
| 101 |
picture_paths.append(picture_path)
|
| 102 |
|
| 103 |
if picture_path is None:
|
| 104 |
-
background_width, background_height = 1344, 768
|
|
|
|
| 105 |
background_prompt = llm_generate_background_prompt(
|
| 106 |
llm_generate,
|
| 107 |
description,
|
|
|
|
| 27 |
font:Font,
|
| 28 |
output_dir: str,
|
| 29 |
num_inference_steps: int,
|
| 30 |
+
image_size_coef: float,
|
| 31 |
) -> Presentation:
|
| 32 |
"""
|
| 33 |
Generate a PowerPoint presentation based on a description using language and image models.
|
|
|
|
| 79 |
image_width, image_height = random.choice(
|
| 80 |
[(768, 1344), (1024, 1024)]
|
| 81 |
)
|
| 82 |
+
image_width, image_height = image_size_coef * image_width, image_size_coef * image_height
|
| 83 |
caption_prompt = llm_generate_image_prompt(
|
| 84 |
llm_generate,
|
| 85 |
description,
|
|
|
|
| 103 |
picture_paths.append(picture_path)
|
| 104 |
|
| 105 |
if picture_path is None:
|
| 106 |
+
# background_width, background_height = 1344, 768
|
| 107 |
+
background_width, background_height = image_size_coef * 1344, image_size_coef * 768
|
| 108 |
background_prompt = llm_generate_background_prompt(
|
| 109 |
llm_generate,
|
| 110 |
description,
|