File size: 622 Bytes
ffdbf63
f673ba6
ffdbf63
f673ba6
 
ffdbf63
f673ba6
 
 
ffdbf63
f673ba6
 
 
 
 
 
ffdbf63
 
f673ba6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

# Load a code-friendly model
generator = pipeline("text-generation", model="codeparrot/codeparrot-small")

def code_helper(prompt):
    output = generator(prompt, max_length=200, do_sample=True, temperature=0.8)
    return output[0]["generated_text"]

iface = gr.Interface(
    fn=code_helper,
    inputs=gr.Textbox(lines=8, placeholder="Ask me to generate, debug, or explain code..."),
    outputs="text",
    title="AI Coding Assistant",
    description="An AI assistant that helps generate, debug, and explain code in Python, C++, JS, and more."
)

iface.launch()