File size: 1,469 Bytes
147d161
 
 
 
 
 
 
 
 
 
 
0068013
2c4ccb6
 
 
0068013
2c4ccb6
 
 
 
0068013
7036bcd
0068013
 
7036bcd
 
 
 
0068013
2c4ccb6
 
 
0068013
2c4ccb6
 
0068013
 
 
 
 
 
 
 
 
2c4ccb6
 
 
 
0068013
2c4ccb6
 
 
 
 
422431d
 
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
---
title: ChatDocxAI
emoji: πŸ“„
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
---

# Backend (FastAPI with Gradio UI)

## Structure
- `api.py` β€” Main FastAPI app
- `app.py` β€” Gradio wrapper for FastAPI
- `utils.py` β€” Helper functions
- `requirements.txt` β€” Python dependencies
- `.env.example` β€” Example environment variables

## Port Configuration
- Single port (7860) with FastAPI mounted at the `/api` path

## API Endpoints
- **Upload Documents**: `https://codegeass321-backendserver.hf.space/api/upload`
- **Ask Questions**: `https://codegeass321-backendserver.hf.space/api/ask`
- **Check Status**: `https://codegeass321-backendserver.hf.space/api/status`
- **API Documentation**: `https://codegeass321-backendserver.hf.space/api/docs`

## Running Locally
```sh
pip install -r requirements.txt
python app.py
```

## Deploying to Hugging Face Spaces
1. Create a new Space with Gradio SDK
2. Upload this repository to the Space
3. Set the following environment variables in the Space settings:
   - `GOOGLE_API_KEY` - Your Google Gemini API key
   - `SUPABASE_URL` - Your Supabase URL
   - `SUPABASE_KEY` - Your Supabase API key

## For Render (Legacy)
- Use the following start command on Render:
  ```
  uvicorn api:app --host 0.0.0.0 --port 10000
  ```
  ```
- Add your environment variables in the Render dashboard

---

**Do not commit your real `.env` file! Use `.env.example` for reference.**

---