Spaces:
Sleeping
Sleeping
|
Download docs/api-reference.md from thanhnv2323/humanize-text: direct link, hf CLI and curl.
- Browser
- Download file 4.06 kB
-
https://huggingface.co/spaces/thanhnv2323/humanize-text/resolve/main/docs/api-reference.md
- Command line
-
hf download hf://spaces/thanhnv2323/humanize-text/docs/api-reference.md
-
curl -L -o api-reference.md https://huggingface.co/spaces/thanhnv2323/humanize-text/resolve/main/docs/api-reference.md
4.06 kB
A newer version of the Gradio SDK is available: 6.32.0
API Reference
Two entry points are available:
src.standard.pipeline— v1.5.1 production Standard Pipeline (recommended)src.methodologies.humanizer— v1.0 multi-method dispatcher (reference)
Standard Pipeline (v1.5.1, recommended)
CLI
python -m src.standard.pipeline [OPTIONS]
| Option | Type | Default | Description |
|---|---|---|---|
--input |
string | required | Input text or path to text file |
--target |
string | en |
Target language code |
--config |
string | config/config.toml |
Path to config file |
--output |
string | stdout | Output file path |
--verbose |
flag | off | Show step-by-step progress |
Examples:
# Basic usage
python -m src.standard.pipeline --input "Your AI text here"
# With verbose step tracing
python -m src.standard.pipeline --input input.txt --output result.txt --verbose
# Different target language
python -m src.standard.pipeline --input input.txt --target zh
Python API
from src.standard import run_standard_pipeline
import toml
config = toml.load("config/config.toml")
result = run_standard_pipeline(
text="Your AI text here",
config=config,
target_lang="en",
)
print(result["result"]) # final humanized text
print(result["processing_time_ms"]) # total elapsed time
for step in result["steps"]:
print(step["step"], step["engine"], step["direction"], step["length"])
# step["engine"] reflects the configured [llm].provider
LLM provider configuration
Steps 1–2 use an OpenAI-compatible chat API configured in config.toml under [llm]:
[llm]
provider = "deepseek" # or "openrouter", "openai", "nvidia"
base_url = "" # empty = provider default; override for custom endpoints
model = "" # empty = provider default model
temperature = 1.3
Resolve settings programmatically:
from src.standard.llm_client import resolve_llm_config
llm = resolve_llm_config(config)
# llm["provider"], llm["base_url"], llm["model"], llm["api_key"], llm["display_name"]
See configuration.md for API keys, provider model slugs, and env overrides (LLM_PROVIDER, LLM_BASE_URL, NVIDIA_API_KEY, etc.).
v1.0 Methodology Dispatcher (reference)
CLI
python -m src.methodologies.humanizer [OPTIONS]
| Option | Type | Default | Description |
|---|---|---|---|
--input |
string | required | Input text or path to text file |
--method |
string | translation_chain |
translation_chain, llm_rewrite, detection_guided, mixed_engine |
--output |
string | stdout | Output file path |
--language |
string | en |
Target language code |
--tier |
string | standard |
Processing tier |
--config |
string | config/config.toml |
Path to config file |
--serve |
flag | off | Start FastAPI server on port 8000 |
Examples:
# Basic usage with a methodology
python -m src.methodologies.humanizer --input "Your AI text here" --method llm_rewrite
# Detection-guided with custom config
python -m src.methodologies.humanizer --input input.txt --method detection_guided --config my_config.toml
Python API
from src.methodologies.humanizer import Humanizer
h = Humanizer(config_path="config/config.toml")
result = h.process("Your AI text here", method="translation_chain")
print(result.text)
REST API (Docker)
When running via Docker, the v1.0 dispatcher's FastAPI app is exposed at http://localhost:8000.
curl -X POST http://localhost:8000/humanize \
-H "Content-Type: application/json" \
-d '{"text": "Your AI text here", "method": "translation_chain"}'
Endpoints:
POST /humanize— run a methodologyGET /methods— list available methodologiesGET /health— health check
Want a managed API with intelligent tier selection? Lynote.ai handles tier selection automatically. Paste & go.