Spaces:
Sleeping
Sleeping
Deploy FastAPI server with CodeLlama 7B
Browse files
README.md
CHANGED
|
@@ -1,13 +1,58 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
python_version: 3.10 # CRITICAL: Targets the compatible Python for our pre-built wheel
|
| 9 |
-
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: CodeLlama API Server
|
| 3 |
+
emoji: 🚀
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
|
|
|
| 8 |
pinned: false
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
startup_duration_timeout: 1h
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# CodeLlama API Server
|
| 14 |
+
|
| 15 |
+
OpenAI-compatible API server running CodeLlama 7B Instruct for code generation.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- OpenAI-compatible `/v1/chat/completions` endpoint
|
| 20 |
+
- OpenAI-compatible `/v1/completions` endpoint
|
| 21 |
+
- Simple `/generate` endpoint for quick testing
|
| 22 |
+
- No rate limiting - designed for unlimited usage
|
| 23 |
+
- Up to 4096 token context and responses
|
| 24 |
+
- CORS enabled for MCP server integration
|
| 25 |
+
|
| 26 |
+
## API Endpoints
|
| 27 |
+
|
| 28 |
+
### Chat Completions (Recommended)
|
| 29 |
+
```bash
|
| 30 |
+
curl -X POST https://truegleai-deepseek-coder-6b-api.hf.space/v1/chat/completions \
|
| 31 |
+
-H "Content-Type: application/json" \
|
| 32 |
+
-d '{
|
| 33 |
+
"model": "codellama-7b-instruct",
|
| 34 |
+
"messages": [
|
| 35 |
+
{"role": "user", "content": "Write a Python function to reverse a string"}
|
| 36 |
+
],
|
| 37 |
+
"max_tokens": 512
|
| 38 |
+
}'
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
### Simple Generation
|
| 42 |
+
```bash
|
| 43 |
+
curl -X POST https://truegleai-deepseek-coder-6b-api.hf.space/generate \
|
| 44 |
+
-H "Content-Type: application/json" \
|
| 45 |
+
-d '{
|
| 46 |
+
"prompt": "Write a Python function to reverse a string",
|
| 47 |
+
"max_tokens": 512
|
| 48 |
+
}'
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## MCP Server Integration
|
| 52 |
+
|
| 53 |
+
Use this Space as a backend for your MCP server by pointing it to:
|
| 54 |
+
```
|
| 55 |
+
https://truegleai-deepseek-coder-6b-api.hf.space
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
The API is OpenAI-compatible, so you can use it anywhere you'd use OpenAI's API.
|