mirror of
https://github.com/QwenLM/Qwen.git
synced 2026-05-21 00:45:48 +08:00
Update README.md
This commit is contained in:
@@ -269,18 +269,18 @@ python web_demo.py
|
|||||||
## API
|
## API
|
||||||
We provide methods to deploy local API based on OpenAI API (thanks to @hanpenggit). Before you start, install the required packages:
|
We provide methods to deploy local API based on OpenAI API (thanks to @hanpenggit). Before you start, install the required packages:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
pip install fastapi uvicorn openai pydantic sse_starlette
|
pip install fastapi uvicorn openai pydantic sse_starlette
|
||||||
```
|
```
|
||||||
Then run the command to deploy your API:
|
Then run the command to deploy your API:
|
||||||
```
|
```bash
|
||||||
python openai_api.py
|
python openai_api.py
|
||||||
```
|
```
|
||||||
You can change your arguments, e.g., `-c` for checkpoint name or path, `--cpu-only` for CPU deployment, etc. If you meet problems launching your API deployment, updating the packages to the latest version can probably solve them.
|
You can change your arguments, e.g., `-c` for checkpoint name or path, `--cpu-only` for CPU deployment, etc. If you meet problems launching your API deployment, updating the packages to the latest version can probably solve them.
|
||||||
|
|
||||||
Using the API is also simple. See the example below:
|
Using the API is also simple. See the example below:
|
||||||
|
|
||||||
```
|
```python
|
||||||
import openai
|
import openai
|
||||||
openai.api_base = "http://localhost:8000/v1"
|
openai.api_base = "http://localhost:8000/v1"
|
||||||
openai.api_key = "none"
|
openai.api_key = "none"
|
||||||
|
|||||||
Reference in New Issue
Block a user