IHCP-code-agent / app.py
Raazz's picture
๐Ÿš€ Add working Gradio app with CodeLlama integration
582689e unverified
Raw History Blame Contribute Delete
634 Bytes
import gradio as gr
from huggingface_hub import InferenceClient
client = InferenceClient(model="codellama/CodeLlama-7b-Instruct-hf")
def explain_code(code):
response = client.text_generation(
prompt=f"Explain this code:\n\n{code}",
max_new_tokens=200,
temperature=0.7
)
return response
demo = gr.Interface(
fn=explain_code,
inputs=gr.Textbox(lines=10, placeholder="Paste your code here...", label="Code"),
outputs="textbox",
title="๐Ÿง  IHCP Code Agent",
description="Explains React, Python, or Solidity code using CodeLlama via Hugging Face Inference API."
)
demo.launch()