--- title: TTS emoji: 🤖 colorFrom: blue colorTo: purple sdk: docker app_port: 7860 models: - unsloth/Qwen3-8B-GGUF --- # Qwen3-8B-GGUF API Space ![Status](https://img.shields.io/badge/Status-Active-success?style=for-the-badge) ![Model](https://img.shields.io/badge/Model-Qwen3--8B--GGUF-blue?style=for-the-badge) ![License](https://img.shields.io/badge/License-Apache--2.0-orange?style=for-the-badge) ![Framework](https://img.shields.io/badge/Framework-FastAPI-009688?style=for-the-badge&logo=fastapi&logoColor=white) A Hugging Face Space that exposes the [`unsloth/Qwen3-8B-GGUF`](https://huggingface.co/unsloth/Qwen3-8B-GGUF) model (8-bit) as a REST API using **FastAPI** and **llama-cpp-python**. ## Endpoints | Method | Path | Description | |--------|-------------|----------------------------------------------| | GET | `/` | HTML documentation page | | POST | `/generate` | Send a message and receive an AI response | | GET | `/health` | Health check (model status) | | GET | `/docs` | Interactive Swagger UI | | GET | `/redoc` | ReDoc documentation | ## POST `/generate` — Request Format ```json { "instructions": "optional system instructions", "message": "required user message", "user": "optional username" } ``` | Field | Type | Required | Description | |----------------|--------|----------|--------------------------------------| | `instructions` | string | No | System-level instructions | | `message` | string | **Yes** | The message to process | | `user` | string | No | Username identifier | ## Prompt Construction The prompt sent to the model is built as: ``` {instructions} {user} said {message} ``` **Example input:** ```json {"instructions": "idk", "message": "thisissupermario", "user": "admin"} ``` **Prompt sent to model:** ``` idk admin said thisissupermario ``` ## Example Usage ### Python ```python import requests response = requests.post( "https://dreamlongyt-agent.hf.space/generate", json={ "instructions": "idk", "message": "thisissupermario", "user": "admin" } ) print(response.json()) ``` ### cURL ```bash curl -X POST "https://dreamlongyt-agent.hf.space/generate" \ -H "Content-Type: application/json" \ -d \'{"instructions":"idk","message":"thisissupermario","user":"admin"}\' ``` ## Deployment 1. Go to [huggingface.co/new-space](https://huggingface.co/new-space) 2. Name your Space and select **Docker** as the SDK 3. Clone the Space repo and push these files: - `app.py` - `Dockerfile` - `requirements.txt` - `README.md` 4. The Space will build automatically and be available at `https://YOUR-USERNAME-YOUR-SPACE-NAME.hf.space` > **Note:** The first request may be slow as the model (~4.7 GB) is downloaded from Hugging Face Hub on startup. > The `llama-cpp-python` library is now installed using pre-compiled wheels for faster setup. > Consider upgrading to a paid hardware tier for faster inference.