Spaces:
Sleeping
Sleeping
File size: 2,298 Bytes
b69b957 c5839ab b9af006 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ---
title: Claw
emoji: 🏢
colorFrom: gray
colorTo: yellow
sdk: docker
pinned: false
license: mit
short_description: Handle responses for claw
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
## Greet JSON Endpoint
The `greet_json` endpoint is located at the root of the application (path `/`).
### How to Call
#### 1. Via Browser
Navigate to the root URL in your browser:
- **Hosted Space**: [devserenerocks-claw.hf.space](https://devserenerocks-claw.hf.space/)
- **Locally**: `http://localhost:7860/`
#### 2. Via cURL
- **Hosted Space**:
```bash
curl https://devserenerocks-claw.hf.space/
```
- **Locally**:
```bash
curl http://localhost:7860/
```
#### 3. Via Python
- **Hosted Space**:
```python
import requests
response = requests.get("https://devserenerocks-claw.hf.space/")
print(response.json())
```
- **Locally**:
```python
import requests
response = requests.get("http://localhost:7860/")
print(response.json())
```
### Expected Response
```json
{
"Hello": "World!"
}
```
## Chat Endpoint
The `chat` endpoint is located at `/chat` and uses Hugging Face's `InferenceClient` (running `nvidia/Llama-3.1-Nemotron-Nano-8B-v1`) to get chat completions.
> [!NOTE]
> This endpoint requires the `HF_TOKEN` environment variable to be set with a valid Hugging Face Hub token.
### How to Call
#### 1. Via cURL
- **Hosted Space**:
```bash
curl -X POST https://devserenerocks-claw.hf.space/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello, how are you?"}'
```
- **Locally**:
```bash
curl -X POST http://localhost:7860/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello, how are you?"}'
```
#### 2. Via Python
- **Hosted Space**:
```python
import requests
payload = {"message": "Hello, how are you?"}
response = requests.post("https://devserenerocks-claw.hf.space/chat", json=payload)
print(response.json())
```
- **Locally**:
```python
import requests
payload = {"message": "Hello, how are you?"}
response = requests.post("http://localhost:7860/chat", json=payload)
print(response.json())
```
### Expected Response
```json
{
"response": "Hello! I am doing well, thank you. How can I help you today?"
}
```
|