""" Minimal Gradio app for docstring generation. Run: python app.py """ import gradio as gr from inference import generate_docstring def summarize_code(code: str) -> str: if not code or not code.strip(): return "Paste a Python code snippet above." return generate_docstring(code, model_name="t5-small", max_length=128, num_beams=4) demo = gr.Interface( fn=summarize_code, inputs=gr.Textbox( label="Python code", placeholder="def add(a, b):\n return a + b", lines=8, ), outputs=gr.Textbox(label="Generated docstring"), title="Python Docstring Generator", description="Paste a Python function or snippet to get a short docstring summary.", ) if __name__ == "__main__": demo.launch()