53 lines
982 B
Markdown
53 lines
982 B
Markdown
# API Usage Guide
|
|
|
|
This project supports multiple methods to start and interact with the API.
|
|
|
|
## Method 1: Standard API Start
|
|
|
|
Start the API using the main script:
|
|
|
|
```
|
|
python main.py
|
|
```
|
|
|
|
## Method 2: Gradio UI
|
|
|
|
To use the Gradio UI:
|
|
|
|
1. In the `endpoints/` directory, change the comment to enable 'gradio'.
|
|
2. Run the UI script:
|
|
|
|
```
|
|
python ui.py
|
|
```
|
|
|
|
## Method 3: Celery Optimization
|
|
|
|
Use Celery for optimized background task processing. You can adjust the parameters for concurrency as needed.
|
|
|
|
### Step 1: Start Redis Server
|
|
|
|
```
|
|
redis-server
|
|
```
|
|
|
|
### Step 2: Start Celery Workers
|
|
|
|
Open two separate terminals and run the following:
|
|
|
|
**Terminal 1 (Preprocessing Queue):**
|
|
```
|
|
celery -A tasks worker --pool=threads --loglevel=info --concurrency=2 --queues=preprocess_queue
|
|
```
|
|
|
|
**Terminal 2 (Inference Queue):**
|
|
```
|
|
celery -A tasks worker --pool=threads --loglevel=info --concurrency=3 --queues=inference_queue
|
|
```
|
|
|
|
### Step 3: Run Debug Script
|
|
|
|
```
|
|
python celery_debug.py
|
|
```
|