Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,45 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
- UI
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: UnivAI Chatbot
|
| 3 |
+
emoji: π€
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
sdk_version: "1.0.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# UnivAI Chatbot Interface & AI Backend
|
| 13 |
+
|
| 14 |
+
This project merges a React UI (Vite) and a Flask AI backend into a single Hugging Face Space using Docker.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- Conversational UI for university handbook queries
|
| 19 |
+
- AI backend (Sentence Transformers + LLM) for semantic search and natural responses
|
| 20 |
+
- Feedback API for upvote/downvote tuning
|
| 21 |
+
|
| 22 |
+
## Running Locally
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
docker build -t univai-chatbot .
|
| 26 |
+
docker run -p 7860:7860 univai-chatbot
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
- UI available at `http://localhost:7860`
|
| 30 |
+
- API available at `http://localhost:7860/api/chat` and `/api/feedback`
|
| 31 |
+
|
| 32 |
+
## Endpoints
|
| 33 |
+
|
| 34 |
+
- **POST /api/chat**
|
| 35 |
+
`{ "query": "your question", "dev_mode": false }` β `{ "response": "answer" }`
|
| 36 |
+
- **POST /api/feedback**
|
| 37 |
+
`{ "query": "...", "response": "...", "feedback": "positive"|"negative" }` β `{ "status": "success" }`
|
| 38 |
+
|
| 39 |
+
## Hugging Face Spaces
|
| 40 |
+
|
| 41 |
+
- Push this repo and select Docker SDK.
|
| 42 |
+
- The UI and AI will run together, with Nginx proxying `/api/` to the backend.
|
| 43 |
+
|
| 44 |
+
## File Structure
|
| 45 |
+
|
| 46 |
+
- `src/` β React UI
|
| 47 |
+
- `app.py` β Flask AI backend
|
| 48 |
+
- `Dockerfile` β unified build
|
| 49 |
+
- `nginx.conf` β reverse proxy config
|
| 50 |
+
- `requirements.txt` β Python dependencies
|
| 51 |
+
- `dataset.json` β university Q&A set
|
| 52 |
+
|
| 53 |
+
## Connecting UI to AI
|
| 54 |
+
|
| 55 |
+
- The UI should send requests to `/api/chat` and `/api/feedback`.
|