Spaces:
Sleeping
Sleeping
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() | |