File size: 1,666 Bytes
96b8200
603ffd1
a654c7f
 
393473c
96b8200
a654c7f
96b8200
 
 
603ffd1
a654c7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Krish Mind
emoji: 🤖
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---

# Krish Mind - Hugging Face Space Deployment

This folder is a ready-to-upload Hugging Face Space package using the mobile GGUF model.

## Model Source
- Repo: Krishkanth/krish-mind-mobile
- File: krish-mind-mobile.gguf
- The model is downloaded automatically at startup using huggingface_hub.

## What Is Included
- app.py: FastAPI backend (llama-cpp, KRCE mode, normal mode, history-aware prompts)
- rag_utils.py: KRCE retrieval and response guards
- static/: Frontend UI
- data/: KRCE knowledge data (clean and legacy)
- Dockerfile: Space runtime image
- requirements.txt: Python dependencies

## Create Space
1. Open Hugging Face and create a new Space.
2. Choose SDK: Docker.
3. Use CPU Basic (free) or better.
4. Create the Space.

## Upload Files
Upload all files and folders from this folder:
- Dockerfile
- requirements.txt
- app.py
- rag_utils.py
- static/
- data/
- README.md

## Deploy Using Git
1. Clone your Space repository.
2. Copy all files from this deployment_hf_mobile folder into the cloned Space folder.
3. Commit and push.

## Environment Variables (Optional)
You can set these in Space Settings if needed:
- HF_HOME=/tmp/huggingface
- TRANSFORMERS_CACHE=/tmp/huggingface

## Runtime Notes
- KRCE mode ON: answers only from KRCE data and abstains for non-KRCE questions.
- KRCE mode OFF: normal model answers using mobile model.
- Backend supports history from frontend to improve answer continuity.

## Local Smoke Test
Run from this folder:

python -m uvicorn app:app --host 0.0.0.0 --port 7860

Then open:
http://127.0.0.1:7860