Spaces:
Sleeping
Sleeping
Download app.py from nutrazzz/IHCP-code-agent: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/spaces/nutrazzz/IHCP-code-agent/resolve/main/app.py
- Command line
-
hf download hf://spaces/nutrazzz/IHCP-code-agent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/nutrazzz/IHCP-code-agent/resolve/main/app.py
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() | |