Spaces:
Build error
Build error
Update README.md
Browse files- backend/README.md +28 -3
backend/README.md
CHANGED
@@ -2,19 +2,44 @@
|
|
2 |
|
3 |
The backend is built using Python & [FastAPI](https://fastapi.tiangolo.com/) bootstrapped with [`create-llama`](https://github.com/run-llama/LlamaIndexTS/tree/main/packages/create-llama).
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
## Getting Started
|
6 |
|
7 |
-
First, setup the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
```bash
|
10 |
poetry install
|
11 |
poetry shell
|
12 |
```
|
13 |
|
14 |
-
|
15 |
|
16 |
```bash
|
17 |
-
python
|
18 |
```
|
19 |
|
20 |
Then call the API endpoint `/api/chat` to see the result:
|
|
|
2 |
|
3 |
The backend is built using Python & [FastAPI](https://fastapi.tiangolo.com/) bootstrapped with [`create-llama`](https://github.com/run-llama/LlamaIndexTS/tree/main/packages/create-llama).
|
4 |
|
5 |
+
## Requirements
|
6 |
+
|
7 |
+
1. Python >= 3.11
|
8 |
+
2. Poetry (To manage dependencies)
|
9 |
+
- ```pipx install poetry```
|
10 |
+
|
11 |
## Getting Started
|
12 |
|
13 |
+
First, setup the `pyproject.toml` file to install the correct version of PyTorch (CPU or GPU):
|
14 |
+
|
15 |
+
Comment/Uncomment the following block depending on your system. Use CPU only if you do not have a supported Cuda Device.
|
16 |
+
|
17 |
+
```bash
|
18 |
+
# For CPU version: Windows and Linux and MacOS (arm64)
|
19 |
+
torch = [
|
20 |
+
{ url = "https://download.pytorch.org/whl/cpu/torch-2.1.1%2Bcpu-cp311-cp311-win_amd64.whl", markers = "sys_platform == 'win32'" },
|
21 |
+
{ url = "https://download.pytorch.org/whl/cpu/torch-2.1.1%2Bcpu-cp311-cp311-linux_x86_64.whl", markers = "sys_platform == 'linux'" },
|
22 |
+
{ url = "https://download.pytorch.org/whl/cpu/torch-2.1.1-cp311-none-macosx_11_0_arm64.whl", markers = "sys_platform == 'darwin'" },
|
23 |
+
]
|
24 |
+
## For GPU version: Windows and Linux and MacOS (arm64)
|
25 |
+
# torch = [
|
26 |
+
# { url = "https://download.pytorch.org/whl/cu121/torch-2.1.1%2Bcu121-cp311-cp311-win_amd64.whl", markers = "sys_platform == 'win32'" },
|
27 |
+
# { url = "https://download.pytorch.org/whl/cu121/torch-2.1.1%2Bcu121-cp311-cp311-linux_x86_64.whl", markers = "sys_platform == 'linux'" },
|
28 |
+
# { url = "https://download.pytorch.org/whl/cu121/torch-2.1.1-cp311-none-macosx_11_0_arm64.whl", markers = "sys_platform == 'darwin'" },
|
29 |
+
# ]
|
30 |
+
```
|
31 |
+
|
32 |
+
Second, setup the environment:
|
33 |
|
34 |
```bash
|
35 |
poetry install
|
36 |
poetry shell
|
37 |
```
|
38 |
|
39 |
+
Third, run the development server:
|
40 |
|
41 |
```bash
|
42 |
+
python run.py
|
43 |
```
|
44 |
|
45 |
Then call the API endpoint `/api/chat` to see the result:
|