UWS_API / README.md
Piyazon
roll back
98b1f2a
---
title: UWS API
emoji: 🏆
colorFrom: red
colorTo: red
sdk: docker
pinned: false
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
## API
The Docker build downloads the official fastText Uyghur Common Crawl binary model, extracts it to `/app/models/cc.ug.300.bin`, and loads it once when the FastAPI app starts.
Model source: https://fasttext.cc/docs/en/crawl-vectors
### Query request
```bash
curl --get "https://<your-space>.hf.space/similarity" \
--data-urlencode "word1=سىزغۇچ" \
--data-urlencode "word2=نان"
```
```bash
curl --get "https://piyazon-uws-api.hf.space/similarity" \
--data-urlencode "word1=سىزغۇچ" \
--data-urlencode "word2=نان"
```
### JSON request
```bash
curl -X POST "https://<your-space>.hf.space/similarity" \
-H "Content-Type: application/json" \
-d '{"word1":"سىزغۇچ","word2":"نان"}'
```
Both endpoints return a JSON number, for example:
```json
42.123456
```