Spaces:
Paused
Paused
Commit
Β·
526ff2e
1
Parent(s):
8083005
added readme
Browse files
README.md
CHANGED
|
@@ -8,3 +8,136 @@ pinned: false
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# LLM Server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# LLM Server
|
| 11 |
+
|
| 12 |
+
This repository contains a FastAPI-based server that serves open-source Large Language Models from Hugging Face.
|
| 13 |
+
|
| 14 |
+
## Getting Started
|
| 15 |
+
|
| 16 |
+
These instructions will help you set up and run the project on your local machine.
|
| 17 |
+
|
| 18 |
+
### Prerequisites
|
| 19 |
+
|
| 20 |
+
- Python 3.10 or higher
|
| 21 |
+
- Git
|
| 22 |
+
|
| 23 |
+
### Cloning the Repository
|
| 24 |
+
|
| 25 |
+
Choose one of the following methods to clone the repository:
|
| 26 |
+
|
| 27 |
+
#### HTTPS
|
| 28 |
+
```bash
|
| 29 |
+
git clone https://huggingface.co/spaces/TeamGenKI/LLMServer
|
| 30 |
+
cd project-name
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
#### SSH
|
| 34 |
+
```bash
|
| 35 |
+
git clone git@hf.co:spaces/TeamGenKI/LLMServer
|
| 36 |
+
cd project-name
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Setting Up the Virtual Environment
|
| 40 |
+
|
| 41 |
+
#### Windows
|
| 42 |
+
```bash
|
| 43 |
+
# Create virtual environment
|
| 44 |
+
python -m venv myenv
|
| 45 |
+
|
| 46 |
+
# Activate virtual environment
|
| 47 |
+
myenv\Scripts\activate
|
| 48 |
+
|
| 49 |
+
# Install dependencies
|
| 50 |
+
pip install -r requirements.txt
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
#### Linux
|
| 54 |
+
```bash
|
| 55 |
+
# Create virtual environment
|
| 56 |
+
python -m venv myenv
|
| 57 |
+
|
| 58 |
+
# Activate virtual environment
|
| 59 |
+
source myenv/bin/activate
|
| 60 |
+
|
| 61 |
+
# Install dependencies
|
| 62 |
+
pip install -r requirements.txt
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
#### macOS
|
| 66 |
+
```bash
|
| 67 |
+
# Create virtual environment
|
| 68 |
+
python3 -m venv myenv
|
| 69 |
+
|
| 70 |
+
# Activate virtual environment
|
| 71 |
+
source myenv/bin/activate
|
| 72 |
+
|
| 73 |
+
# Install dependencies
|
| 74 |
+
pip3 install -r requirements.txt
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### Running the Application
|
| 78 |
+
|
| 79 |
+
Once you have set up your environment and installed the dependencies, you can start the FastAPI application:
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
uvicorn main.app:app --reload
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
The API will be available at `http://localhost:8001`
|
| 86 |
+
|
| 87 |
+
### API Documentation
|
| 88 |
+
|
| 89 |
+
Once the application is running, you can access:
|
| 90 |
+
- Interactive API documentation (Swagger UI) at `http://localhost:8000/docs`
|
| 91 |
+
- Alternative API documentation (ReDoc) at `http://localhost:8000/redoc`
|
| 92 |
+
|
| 93 |
+
### Deactivating the Virtual Environment
|
| 94 |
+
|
| 95 |
+
When you're done working on the project, you can deactivate the virtual environment:
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
deactivate
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Contributing
|
| 102 |
+
|
| 103 |
+
[Add contributing guidelines here]
|
| 104 |
+
|
| 105 |
+
## License
|
| 106 |
+
|
| 107 |
+
[Add license information here]
|
| 108 |
+
|
| 109 |
+
## Project Structure
|
| 110 |
+
|
| 111 |
+
```
|
| 112 |
+
.
|
| 113 |
+
βββ Dockerfile
|
| 114 |
+
βββ main
|
| 115 |
+
β βββ api.py
|
| 116 |
+
β βββ app.py
|
| 117 |
+
β βββ config.yaml
|
| 118 |
+
β βββ env_template
|
| 119 |
+
β βββ __init__.py
|
| 120 |
+
β βββ logs
|
| 121 |
+
β β βββ llm_api.log
|
| 122 |
+
β βββ models
|
| 123 |
+
β βββ __pycache__
|
| 124 |
+
β β βββ api.cpython-39.pyc
|
| 125 |
+
β β βββ app.cpython-39.pyc
|
| 126 |
+
β β βββ __init__.cpython-39.pyc
|
| 127 |
+
β β βββ routes.cpython-39.pyc
|
| 128 |
+
β βββ routes.py
|
| 129 |
+
β βββ test_locally.py
|
| 130 |
+
β βββ utils
|
| 131 |
+
β βββ errors.py
|
| 132 |
+
β βββ helpers.py
|
| 133 |
+
β βββ __init__.py
|
| 134 |
+
β βββ logging.py
|
| 135 |
+
β βββ __pycache__
|
| 136 |
+
β β βββ helpers.cpython-39.pyc
|
| 137 |
+
β β βββ __init__.cpython-39.pyc
|
| 138 |
+
β β βββ logging.cpython-39.pyc
|
| 139 |
+
β β βββ validation.cpython-39.pyc
|
| 140 |
+
β βββ validation.py
|
| 141 |
+
βββ README.md
|
| 142 |
+
βββ requirements.txt
|
| 143 |
+
```
|