Spaces:
Sleeping
Sleeping
Document the 1.5B and 0.5B public API endpoints
Browse files
README.md
CHANGED
|
@@ -19,3 +19,29 @@ short_description: Generate and execute awk programs from plain language
|
|
| 19 |
Enter a plain-language text-processing request and representative input. Awkweave generates an `awk` program and executes it locally in the Space with file, environment, pipe, and process access disabled.
|
| 20 |
|
| 21 |
The demo offers [asterbraid/awkweave-1.5b](https://huggingface.co/asterbraid/awkweave-1.5b) for accuracy and [asterbraid/awkweave-0.5b](https://huggingface.co/asterbraid/awkweave-0.5b) for speed. It supports simple space-, tab-, and comma-separated input; quoted CSV is out of scope. Generated programs can be wrong, so review them before reuse.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
Enter a plain-language text-processing request and representative input. Awkweave generates an `awk` program and executes it locally in the Space with file, environment, pipe, and process access disabled.
|
| 20 |
|
| 21 |
The demo offers [asterbraid/awkweave-1.5b](https://huggingface.co/asterbraid/awkweave-1.5b) for accuracy and [asterbraid/awkweave-0.5b](https://huggingface.co/asterbraid/awkweave-0.5b) for speed. It supports simple space-, tab-, and comma-separated input; quoted CSV is out of scope. Generated programs can be wrong, so review them before reuse.
|
| 22 |
+
|
| 23 |
+
## API usage
|
| 24 |
+
|
| 25 |
+
Install the client and call either endpoint. The response contains the generated program, executed output, and status message.
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
pip install gradio_client
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from gradio_client import Client
|
| 33 |
+
|
| 34 |
+
client = Client("asterbraid/awkweave-demo")
|
| 35 |
+
request = "For each record, print column 1 and the running sum of column 2, separated by a space."
|
| 36 |
+
sample = "alice 10\nbruno 15\nchen 7\n"
|
| 37 |
+
|
| 38 |
+
# Awkweave 1.5B
|
| 39 |
+
large = client.predict(request, sample, api_name="/predict")
|
| 40 |
+
print(large)
|
| 41 |
+
|
| 42 |
+
# Awkweave 0.5B
|
| 43 |
+
small = client.predict(request, sample, api_name="/predict_small")
|
| 44 |
+
print(small)
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Both should return the program `{s+=$2;print $1,s}` and output `alice 10\nbruno 25\nchen 32\n`. The original two-argument `/predict` signature is unchanged.
|