A high-performance AI inference server built with Rust and Candle framework, optimized for concurrent model inference with enterprise-grade features.
curl -X POST https://your-space.hf.space/api/v1/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello, world!", "model": "tinyllama"}'
# TinyLlama (fast, 1.1B params)
curl -X POST https://your-space.hf.space/api/v1/generate \
-d '{"prompt": "Explain AI", "model": "tinyllama"}'
# Generic Llama (flexible)
curl -X POST https://your-space.hf.space/api/v1/generate \
-d '{"prompt": "What is Rust?", "model": "llama-generic"}'
curl -X POST https://your-space.hf.space/api/v1/generate/upload \
-F "file=@document.txt" \
-F "prompt=Summarize this document" \
-F "model=tinyllama"
GET /health
Response:
{
"status": "healthy",
"service": "ai-inference-server",
"version": "0.1.0",
"timestamp": "2024-01-01T00:00:00Z"
}
POST /v1/generate
Content-Type: application/json
{
"prompt": "Hello, how are you?",
"max_tokens": 100,
"temperature": 0.7,
"model": "microsoft/DialoGPT-medium"
}
Response:
{
"id": "uuid-here",
"text": "Generated response text",
"model": "microsoft/DialoGPT-medium",
"usage": {
"prompt_tokens": 4,
"completion_tokens": 100,
"total_tokens": 104
}
}
src/
βββ lib.rs # Module declarations
βββ config.rs # Configuration management
βββ error.rs # Error types and handling
βββ api/
β βββ mod.rs # API router setup
β βββ health.rs # Health check endpoints
β βββ generate.rs # Text generation endpoints
βββ models/
βββ mod.rs # Model loading and management
cargo test
cargo clippy
cargo fmt
MIT License - see LICENSE file for details.
15 commits
Rust
96.1%
TypeScript
2.1%
A high-performance AI inference server built with Rust and Candle framework, optimized for concurrent model inference with enterprise-grade features.
curl -X POST https://your-space.hf.space/api/v1/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello, world!", "model": "tinyllama"}'
# TinyLlama (fast, 1.1B params)
curl -X POST https://your-space.hf.space/api/v1/generate \
-d '{"prompt": "Explain AI", "model": "tinyllama"}'
# Generic Llama (flexible)
curl -X POST https://your-space.hf.space/api/v1/generate \
-d '{"prompt": "What is Rust?", "model": "llama-generic"}'
curl -X POST https://your-space.hf.space/api/v1/generate/upload \
-F "file=@document.txt" \
-F "prompt=Summarize this document" \
-F "model=tinyllama"
GET /health
Response:
{
"status": "healthy",
"service": "ai-inference-server",
"version": "0.1.0",
"timestamp": "2024-01-01T00:00:00Z"
}
POST /v1/generate
Content-Type: application/json
{
"prompt": "Hello, how are you?",
"max_tokens": 100,
"temperature": 0.7,
"model": "microsoft/DialoGPT-medium"
}
Response:
{
"id": "uuid-here",
"text": "Generated response text",
"model": "microsoft/DialoGPT-medium",
"usage": {
"prompt_tokens": 4,
"completion_tokens": 100,
"total_tokens": 104
}
}
src/
βββ lib.rs # Module declarations
βββ config.rs # Configuration management
βββ error.rs # Error types and handling
βββ api/
β βββ mod.rs # API router setup
β βββ health.rs # Health check endpoints
β βββ generate.rs # Text generation endpoints
βββ models/
βββ mod.rs # Model loading and management
cargo test
cargo clippy
cargo fmt
MIT License - see LICENSE file for details.
15 commits
Rust
96.1%
TypeScript
2.1%