--- 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?" } ```