Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# You can change the model to any light-weight code model
|
5 |
+
pipe = pipeline("text-generation", model="Salesforce/codegen-350M-mono")
|
6 |
+
|
7 |
+
def generate(prompt):
|
8 |
+
result = pipe(prompt, max_new_tokens=200)
|
9 |
+
return result[0]['generated_text']
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
fn=generate,
|
13 |
+
inputs=gr.Textbox(lines=4, placeholder="Enter code prompt here..."),
|
14 |
+
outputs="text",
|
15 |
+
title="Code Helper AI"
|
16 |
+
).launch()
|