Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Using a lightweight model to stay within free tier limits | |
| generator = pipeline("text-generation", model="Salesforce/codegen2-1B", max_new_tokens=1024) | |
| def generate_website_code(prompt): | |
| system_prompt = ( | |
| f"Create a fully responsive website with HTML, CSS, and JavaScript. " | |
| f"Use these requirements: {prompt}.\n\n" | |
| f"Return full code with all parts embedded." | |
| ) | |
| result = generator(system_prompt)[0]["generated_text"] | |
| return result | |
| gr.Interface( | |
| fn=generate_website_code, | |
| inputs=gr.Textbox(lines=5, label="Describe the website you want (theme, brand, images, colors)"), | |
| outputs="text", | |
| title="AI Website Generator" | |
| ).launch() | |