| import gradio as gr | |
| import random | |
| def generate_wireframe(prompt, header_font, body_font, primary_color, secondary_color): | |
| wireframe = { | |
| "title": prompt, | |
| "fonts": { | |
| "header": header_font, | |
| "body": body_font | |
| }, | |
| "colors": { | |
| "primary": primary_color, | |
| "secondary": secondary_color | |
| }, | |
| "content": { | |
| "header": f"{prompt} - A Landing Page", | |
| "paragraphs": [f"This is paragraph {i+1} of content for {prompt}." for i in range(10)], | |
| "testimonials": [ | |
| {"name": f"User {i+1}", "review": f"This is a testimonial {i+1} for {prompt}."} | |
| for i in range(5) | |
| ], | |
| "images": [ | |
| {"description": f"Description for image {i+1} related to {prompt}."} | |
| for i in range(10) | |
| ] | |
| } | |
| } | |
| return wireframe | |
| header_font_choices = ["Roboto", "Lato", "Montserrat", "Poppins", "Open Sans"] | |
| body_font_choices = ["Roboto", "Lato", "Montserrat", "Poppins", "Open Sans"] | |
| demo = gr.Interface( | |
| fn=generate_wireframe, | |
| inputs=[ | |
| gr.Textbox(label="Landing Page Prompt"), | |
| gr.Dropdown(header_font_choices, label="Header Font"), | |
| gr.Dropdown(body_font_choices, label="Body Font"), | |
| gr.ColorPicker(label="Primary Color"), | |
| gr.ColorPicker(label="Secondary Color") | |
| ], | |
| outputs=gr.JSON(), | |
| title="Landing Page Wireframe Generator", | |
| description="Generate a structured wireframe for a landing page based on a user prompt." | |
| ) | |
| demo.launch() | |