File size: 1,741 Bytes
6db5454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: doc-to-lora UI
emoji: πŸͺž
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 7860
suggested_hardware: cpu-basic
pinned: false
---

# Etiya doc-to-lora β€” Web UI

Companion frontend for [`Etiya/d2l-api`](https://huggingface.co/spaces/Etiya/d2l-api).

## Architecture

```
Browser
   β”‚
   β–Ό
Etiya/d2l-ui     (this Space β€” Docker SDK, CPU basic, Next.js)
   β”‚
   β”‚  /api/proxy/*  β€” server-side, adds Authorization: Bearer ${HF_TOKEN}
   β–Ό
Etiya/d2l-api    (backend Space β€” A100, doc-to-lora + Gemma-2-2b-it)
```

The frontend calls the backend Space using a server-side proxy. The HF token is set as a Space Secret on this UI Space and never reaches the browser.

## Pages

- `/` β€” hero + quick ask
- `/ask` β€” chat interface with advanced parameter sliders
- `/documents` β€” CRUD for the 1,166 BSS document corpus
- `/system` β€” health, GPU, latency, re-index controls

## Required Space secret

Set on this Space's `Settings β†’ Variables and secrets β†’ New secret`:

| Name | Type | Value |
|---|---|---|
| `HF_TOKEN` | Secret | An HF write token with read access to `Etiya/d2l-api` |

Optional:

| Name | Type | Default |
|---|---|---|
| `D2L_API_URL` | Variable | `https://etiya-d2l-api.hf.space` |

## Local development

This Space is a regular Next.js 14 app. To work on it locally:

```bash
git clone https://huggingface.co/spaces/Etiya/d2l-ui
cd d2l-ui
npm install
cp .env.example .env.local      # add HF_TOKEN
npm run dev                      # http://localhost:3000
```

Or via Docker:

```bash
docker compose up --build        # http://localhost:3000
```

## Hardware

This Space runs on `cpu-basic` (free) β€” Next.js is light. The heavy lifting (GPU inference) happens on the backend Space.