File size: 1,407 Bytes
3f3c728
523550b
 
3f3c728
53f9c70
3f3c728
 
523550b
53f9c70
523550b
53f9c70
523550b
53f9c70
523550b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Hannah-Pilot-Interface
duplicate_from: null
sdk: docker
app_port: 7860
---

# Hannah Pilot Interface (Docker Space)

This HuggingFace Space serves a FastAPI backend for the Hannah web UI.

## ✅ Endpoints

- `GET /api/models` – lists available `.gguf` models in the repo
- `GET /api/status` – lightweight health/status (RAM + CPU)
- `POST /api/gen_title` – generates a short chat title
- `POST /api/chat`**streams NDJSON** responses (`application/x-ndjson`)

## Frontend Setup

In your HTML frontend, set:

```js
const API_BASE = "https://fugthchat-hannah-pilot-interface.hf.space";
```

Your frontend should call:
- `POST ${API_BASE}/api/chat`
- `GET ${API_BASE}/api/models`
- `GET ${API_BASE}/api/status`

## Models

Upload your model files into the Space repo root:

- `qwen2.5-0.5b-instruct-q2_k.gguf` (Light)
- `qwen2.5-0.5b-instruct-q4_k_m.gguf` (Heavy)

The backend auto-detects all `*.gguf` files.

## Avoiding Build Loops

This Space uses:
- Docker listening on `0.0.0.0:7860`
- `app_port: 7860` in the README header

If your Space keeps restarting:
1. Confirm the app listens on port `7860`.
2. Confirm `CMD` runs `uvicorn app:app --host 0.0.0.0 --port 7860`.
3. Check the Space logs for dependency install failures.

## Notes

- This is CPU-friendly config (`n_threads=2`) for HuggingFace free tier.
- Response streaming is NDJSON (one JSON per line: `{ "text": "..." }`).