|
|
--- |
|
|
title: UnivAI Chatbot |
|
|
emoji: π€ |
|
|
colorFrom: purple |
|
|
colorTo: blue |
|
|
sdk: docker |
|
|
sdk_version: "1.0.0" |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
--- |
|
|
|
|
|
# UnivAI Chatbot Interface & AI Backend |
|
|
|
|
|
This project merges a React UI (Vite) and a Flask AI backend into a single Hugging Face Space using Docker. |
|
|
|
|
|
## Features |
|
|
|
|
|
- Conversational UI for university handbook queries |
|
|
- AI backend (Sentence Transformers + LLM) for semantic search and natural responses |
|
|
- Feedback API for upvote/downvote tuning |
|
|
|
|
|
## Running Locally |
|
|
|
|
|
```bash |
|
|
docker build -t univai-chatbot . |
|
|
docker run -p 7860:7860 univai-chatbot |
|
|
``` |
|
|
|
|
|
- UI available at `http://localhost:7860` |
|
|
- API available at `http://localhost:7860/api/chat` and `/api/feedback` |
|
|
|
|
|
## Endpoints |
|
|
|
|
|
- **POST /api/chat** |
|
|
`{ "query": "your question", "dev_mode": false }` β `{ "response": "answer" }` |
|
|
- **POST /api/feedback** |
|
|
`{ "query": "...", "response": "...", "feedback": "positive"|"negative" }` β `{ "status": "success" }` |
|
|
|
|
|
## Hugging Face Spaces |
|
|
|
|
|
- Push this repo and select Docker SDK. |
|
|
- The UI and AI will run together, with Nginx proxying `/api/` to the backend. |
|
|
|
|
|
## File Structure |
|
|
|
|
|
- `src/` β React UI |
|
|
- `app.py` β Flask AI backend |
|
|
- `Dockerfile` β unified build |
|
|
- `nginx.conf` β reverse proxy config |
|
|
- `requirements.txt` β Python dependencies |
|
|
- `dataset.json` β university Q&A set |
|
|
|
|
|
## Connecting UI to AI |
|
|
|
|
|
- The UI should send requests to `/api/chat` and `/api/feedback`. |
|
|
|