Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load AI Model
|
5 |
+
code_generator = pipeline("text-generation", model="Salesforce/codegen-6B-mono")
|
6 |
+
|
7 |
+
# Function to generate code from prompts
|
8 |
+
def generate_code(prompt):
|
9 |
+
result = code_generator(prompt, max_length=200)
|
10 |
+
return result[0]['generated_text']
|
11 |
+
|
12 |
+
# Gradio Interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=generate_code,
|
15 |
+
inputs="text",
|
16 |
+
outputs="text",
|
17 |
+
title="AI Project Creator",
|
18 |
+
description="Enter a prompt to generate a full-stack project scaffold."
|
19 |
+
)
|
20 |
+
iface.launch()
|