Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,18 @@
|
|
| 1 |
-
|
| 2 |
from transformers import pipeline
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
generator = pipeline("text2text-generation", model="
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
# Instruction prompt to ensure web-style code output
|
| 10 |
-
full_prompt = f"Generate a modern HTML, CSS, and JavaScript website. {prompt}"
|
| 11 |
-
|
| 12 |
-
result = generator(full_prompt, max_length=1024, do_sample=True)[0]['generated_text']
|
| 13 |
return result
|
| 14 |
|
| 15 |
-
|
| 16 |
-
gr.
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
).launch()
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
from transformers import pipeline
|
| 3 |
+
import gradio as gr
|
| 4 |
|
| 5 |
+
# Use a better model trained for HTML generation
|
| 6 |
+
generator = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-web-code")
|
| 7 |
|
| 8 |
+
def generate_site(prompt):
|
| 9 |
+
result = generator(prompt, max_length=2048, do_sample=True)[0]["generated_text"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
return result
|
| 11 |
|
| 12 |
+
iface = gr.Interface(fn=generate_site,
|
| 13 |
+
inputs=gr.Textbox(lines=10, placeholder="Enter your website prompt..."),
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="AI Website Generator",
|
| 16 |
+
description="Enter a prompt to generate a modern HTML/CSS/JS website")
|
| 17 |
+
|
| 18 |
+
iface.launch()
|
|
|