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

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -60
README.md CHANGED
@@ -1,66 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
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
-
 
1
+ ---
2
+ title: Text Embedding API
3
+ emoji: 🚀
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ sdk_version: "latest"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
  # Text Embedding API
13
 
14
  API นี้ช่วยแปลงข้อความเป็นเวกเตอร์โดยใช้โมเดล `sentence-transformers/all-MiniLM-L6-v2` บน Hugging Face Spaces
15
 
16
  ## 🚀 **การใช้งาน API**
17
  **Endpoint:**