Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,11 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
from transformers import pipeline
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
generator = pipeline("text-generation", model="Salesforce/codegen2-1B", max_new_tokens=1024)
|
| 6 |
|
| 7 |
def generate_website_code(prompt):
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
f"Use these requirements: {prompt}.\n\n"
|
| 11 |
-
f"Return full code with all parts embedded."
|
| 12 |
-
)
|
| 13 |
-
result = generator(system_prompt)[0]["generated_text"]
|
| 14 |
return result
|
| 15 |
|
| 16 |
-
gr.Interface(
|
| 17 |
-
fn=generate_website_code,
|
| 18 |
-
inputs=gr.Textbox(lines=5, label="Describe the website you want (theme, brand, images, colors)"),
|
| 19 |
-
outputs="text",
|
| 20 |
-
title="AI Website Generator"
|
| 21 |
-
).launch()
|
|
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
|
| 4 |
+
generator = pipeline("text2text-generation", model="google/flan-t5-small")
|
|
|
|
| 5 |
|
| 6 |
def generate_website_code(prompt):
|
| 7 |
+
full_prompt = f"Create a stylish animated HTML, CSS, and JS website using this prompt: {prompt}"
|
| 8 |
+
result = generator(full_prompt, max_new_tokens=1024)[0]["generated_text"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
return result
|
| 10 |
|
| 11 |
+
gr.Interface(fn=generate_website_code, inputs="text", outputs="text", title="Website Generator").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|