640510702phithak commited on
Commit
a413fde
·
verified ·
1 Parent(s): b34c8f6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -8
README.md CHANGED
@@ -1,11 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: Text Embedding Api
3
- emoji: 📉
4
- colorFrom: indigo
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- short_description: abcd
 
 
 
 
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Text Embedding API
2
+
3
+ API นี้ช่วยแปลงข้อความเป็นเวกเตอร์โดยใช้โมเดล `sentence-transformers/all-MiniLM-L6-v2` บน Hugging Face Spaces
4
+
5
+ ## 🚀 **การใช้งาน API**
6
+ **Endpoint:**
7
+ ```
8
+ POST https://640510702phithak-text-embedding-api.hf.space/embed
9
+ ```
10
+
11
+ **Request Body (JSON):**
12
+ ```json
13
+ {
14
+ "text": "ข้อความที่ต้องการแปลงเป็นเวกเตอร์"
15
+ }
16
+ ```
17
+
18
+ **Response (JSON):**
19
+ ```json
20
+ {
21
+ "text": "ข้อความที่ส่งไป",
22
+ "embedding": [0.12, -0.45, 0.78, ...] // เวกเตอร์
23
+ }
24
+ ```
25
+
26
  ---
27
+
28
+ ## 🔹 **ใช้งาน API ด้วย Python**
29
+ ```python
30
+ import requests
31
+
32
+ url = "https://640510702phithak-text-embedding-api.hf.space/embed"
33
+ data = {"text": "hello world"}
34
+ response = requests.post(url, json=data)
35
+ print(response.json())
36
+ ```
37
+
38
  ---
39
 
40
+ ## 🔹 **ใช้งาน API ด้วย JavaScript (Node.js)**
41
+ ```javascript
42
+ const fetch = require('node-fetch');
43
+
44
+ const url = "https://640510702phithak-text-embedding-api.hf.space/embed";
45
+ const data = { text: "hello world" };
46
+
47
+ fetch(url, {
48
+ method: "POST",
49
+ headers: { "Content-Type": "application/json" },
50
+ body: JSON.stringify(data)
51
+ })
52
+ .then(response => response.json())
53
+ .then(result => console.log(result))
54
+ .catch(error => console.error("Error:", error));
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 📌 **หมายเหตุ**
60
+ - API นี้ใช้โมเดลขนาดเล็กเหมาะสำหรับงานเบา ๆ เช่น **Semantic Search** หรือ **Text Clustering**
61
+ - หากต้องการประสิทธิภาพสูงขึ้นสามารถเปลี่ยนเป็นโมเดลอื่นของ [Sentence Transformers](https://huggingface.co/models?search=sentence-transformers)
62
+
63
+ ---
64
+
65
+ 📢 **มีคำถามหรือปัญหา?** ติดต่อเราได้ที่ [GitHub Issues](https://github.com/your-repo/issues) หรืออีเมล support@example.com 🚀
66
+