wjm55 commited on
Commit
91da5d0
·
1 Parent(s): a22df0e

Add Tokenizer API documentation to README.md with usage examples in curl, Python, and JavaScript

Browse files
Files changed (1) hide show
  1. README.md +40 -0
README.md CHANGED
@@ -7,4 +7,44 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  pinned: false
8
  ---
9
 
10
+ # Tokenizer API
11
+
12
+ A simple API for tokenizing text using spaCy.
13
+
14
+ ## Usage Examples
15
+
16
+ ### Using curl
17
+ ```bash
18
+ curl -X POST "https://theirstory-tokenizer.hf.space:7860/tokenize" \
19
+ -H "Content-Type: application/json" \
20
+ -d '{"text": "Hello world!"}'
21
+ ```
22
+
23
+ ### Using Python
24
+ ```python
25
+ import requests
26
+
27
+ response = requests.post(
28
+ "https://theirstory-tokenizer.hf.space:7860/tokenize",
29
+ json={"text": "Hello world!"}
30
+ )
31
+ tokens = response.json()
32
+ print(tokens)
33
+ ```
34
+
35
+ ### Using JavaScript
36
+ ```javascript
37
+ const response = await fetch('https://theirstory-tokenizer.hf.space:7860/tokenize', {
38
+ method: 'POST',
39
+ headers: {
40
+ 'Content-Type': 'application/json',
41
+ },
42
+ body: JSON.stringify({
43
+ text: 'Hello world!'
44
+ })
45
+ });
46
+ const tokens = await response.json();
47
+ console.log(tokens);
48
+ ```
49
+
50
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference