MCPcopy Create free account
hub / github.com/MeiGen-AI/PosterCraft / generate

Method generate

inference.py:126–157  ·  view source on GitHub ↗
(self, 
                 prompt, 
                 enable_recap=True,
                 width=832, 
                 height=1216, 
                 num_inference_steps=28, 
                 guidance_scale=3.5, 
                 seed=None)

Source from the content-addressed store, hash-verified

124 self.pipeline.to(self.device)
125
126 def generate(self,
127 prompt,
128 enable_recap=True,
129 width=832,
130 height=1216,
131 num_inference_steps=28,
132 guidance_scale=3.5,
133 seed=None):
134
135 # Prompt rewriting
136 if enable_recap and self.qwen_agent:
137 final_prompt = self.qwen_agent.recap_prompt(prompt)
138 else:
139 final_prompt = prompt
140
141 # Poster generation
142 if seed is None:
143 seed = random.randint(1, 2**32 - 1)
144
145 generator = torch.Generator(device=self.device).manual_seed(seed)
146
147 with torch.inference_mode():
148 image = self.pipeline(
149 prompt=final_prompt,
150 generator=generator,
151 num_inference_steps=num_inference_steps,
152 guidance_scale=guidance_scale,
153 width=width,
154 height=height
155 ).images[0]
156
157 return image, final_prompt, seed
158
159
160def main():

Callers 2

mainFunction · 0.95
recap_promptMethod · 0.45

Calls 1

recap_promptMethod · 0.45

Tested by

no test coverage detected