Spaces:
Running
Running
File size: 2,209 Bytes
9d1ffbc aff08a4 9d1ffbc aff08a4 9d1ffbc aff08a4 9d1ffbc aff08a4 14a4094 aff08a4 14a4094 aff08a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
---
title: CodeLlama Code Generator
emoji: 🦙
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
license: bigscience-openrail-m
short_description: Interactive CodeLlama code generation demo
---
# CodeLlama Code Generator
This is an interactive demo of the CodeLlama-7b model for generating code completions. The application provides a simple interface where you can enter a code prompt and get AI-generated code completions.
## Features
- Interactive code generation with CodeLlama-7b model
- Adjustable parameters (temperature, max length, etc.)
- Example prompts to get started quickly
- Real-time generation with timing information
## How to Use
1. Enter a code prompt in the input box (e.g., a function signature or class definition)
2. Adjust the generation parameters if needed:
- **Max Length**: Controls the maximum length of the generated text
- **Temperature**: Controls randomness (lower = more deterministic)
- **Top-p**: Controls diversity via nucleus sampling
- **Top-k**: Controls diversity via top-k sampling
3. Click "Generate Code" to get your completion
4. Try different prompts and parameters to see how they affect the output
## Examples
The demo includes several example prompts to help you get started:
- Function to implement exponential backoff for network pings
- Fibonacci sequence implementation
- Binary search tree class
- Asynchronous data fetching function
## Authentication Requirements
**Important**: CodeLlama is a gated model that requires authentication to access. To use this demo:
1. You must accept the model's license at [meta-llama/CodeLlama-7b-hf](https://huggingface.co/meta-llama/CodeLlama-7b-hf)
2. You need to set your Hugging Face token in the Space's settings:
- Go to Settings > Repository Secrets > Add
- Create a secret named `HF_TOKEN` with your Hugging Face token as the value
Without proper authentication, the demo will show a limited interface with instructions.
## Technical Details
This demo uses:
- CodeLlama-7b model from Meta
- Hugging Face Transformers library
- Gradio for the web interface
## License
This demo is provided under the BigScience OpenRAIL-M license.
|