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

Function generate_image_interface

demo_gradio.py:162–186  ·  view source on GitHub ↗
(
    original_prompt, enable_recap, height, width, 
    num_inference_steps, guidance_scale, seed_input
)

Source from the content-addressed store, hash-verified

160
161# --- Gradio Interface Logic ---
162def generate_image_interface(
163 original_prompt, enable_recap, height, width,
164 num_inference_steps, guidance_scale, seed_input
165):
166 if not original_prompt or not original_prompt.strip():
167 raise gr.Error("Prompt cannot be empty!")
168
169 try:
170 actual_seed = int(seed_input) if seed_input and seed_input > 0 else random.randint(1, 2**32 - 1)
171
172 image, final_prompt = generator.generate(
173 prompt=original_prompt,
174 enable_recap=enable_recap,
175 height=int(height),
176 width=int(width),
177 num_inference_steps=int(num_inference_steps),
178 guidance_scale=float(guidance_scale),
179 seed=actual_seed
180 )
181
182 status_log = f"Seed: {actual_seed} | Generation complete."
183 return image, final_prompt, status_log
184
185 except Exception as e:
186 raise gr.Error(f"An error occurred: {e}")
187
188
189# --- Gradio UI Definition ---

Callers

nothing calls this directly

Calls 1

generateMethod · 0.45

Tested by

no test coverage detected