Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
-
# app.py
|
2 |
from transformers import pipeline
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
-
#
|
6 |
-
generator = pipeline("text2text-generation", model="
|
7 |
|
8 |
-
def
|
9 |
-
|
10 |
-
return
|
11 |
|
12 |
-
iface = gr.Interface(
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
|
18 |
iface.launch()
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
import torch
|
3 |
import gradio as gr
|
4 |
|
5 |
+
# Make sure torch is imported and available
|
6 |
+
generator = pipeline("text2text-generation", model="google/flan-t5-base")
|
7 |
|
8 |
+
def generate_code(prompt):
|
9 |
+
output = generator(prompt, max_length=2048, do_sample=True)[0]["generated_text"]
|
10 |
+
return output
|
11 |
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=generate_code,
|
14 |
+
inputs=gr.Textbox(lines=5, placeholder="Enter your website prompt here..."),
|
15 |
+
outputs="text",
|
16 |
+
title="Website Code Generator",
|
17 |
+
description="Enter a prompt like: 'Create a modern café website using beige and brown with animations.'"
|
18 |
+
)
|
19 |
|
20 |
iface.launch()
|