Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 4,497 Bytes
5acd9c3 523275c 5acd9c3 a3d40b4 5acd9c3 ce42baf 5acd9c3 f26b729 5acd9c3 f26b729 5acd9c3 f26b729 5acd9c3 f26b729 a3d40b4 5acd9c3 f26b729 5acd9c3 a3d40b4 5acd9c3 a3d40b4 5acd9c3 a3d40b4 5acd9c3 59e0f6a a3d40b4 59e0f6a ce42baf 5acd9c3 59e0f6a 5acd9c3 ef8ee9e a3d40b4 ef8ee9e a3d40b4 5acd9c3 ef8ee9e 523275c ef8ee9e 523275c ef8ee9e a3d40b4 ef8ee9e a3d40b4 ef8ee9e |
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
## Deploying tikslop to https://tikslop.com
Note: this document is meant for tikslop administrators only, not the general public.
TikSlop is not an app/tool but a website, it is not designed to be cloned (technically you can, but since this is not a goal it is not documented).
### Setup the domain
TODO
### Seting up the Python virtual environment
```bash
python3 -m venv .python_venv
source .python_venv/bin/activate
python3 -m pip install --no-cache-dir --upgrade -r requirements.txt
```
### Local testing
First you need to build the app:
$ flutter build web
Then run the server.
See paragraph "Running the gateway scheduler"
### Deployment to production
To deploy the tikslop api to production:
$ flutter build web
$ git add .
$ got commit -m "<description>"
$ git push public main
and upload the assets to:
https://huggingface.co/spaces/jbilcke-hf/tikslop/tree/main/public
#### Running a rendering node
Current tikslop uses `jbilcke-hf/LTX-Video-0-9-6-HFIE` as a rendering node.
tikslop uses a round-robin schedule implemented on the gateway.
This helps ensuring a smooth attribution of requests.
What works well is to use the target number of users in parallel (eg. 3) and use 50% more capability to make sure we can handle the load, so in this case about 5 servers.
```bash
# note: you need to replace <YOUR_ACCOUNT_NAME>, <ROUND_ROBIN_INDEX> and <YOUR_HF_TOKEN>
curl https://api.endpoints.huggingface.cloud/v2/endpoint/<YOUR_ACCOUNT_NAME> -X POST -d '{"cacheHttpResponses":false,"compute":{"accelerator":"gpu","instanceSize":"x1","instanceType":"nvidia-l40s","scaling":{"maxReplica":1,"measure":{"hardwareUsage":80},"minReplica":0,"scaleToZeroTimeout":120,"metric":"hardwareUsage"}},"model":{"env":{},"framework":"custom","image":{"huggingface":{}},"repository":"jbilcke-hf/LTX-Video-0-9-6-HFIE","secrets":{},"task":"custom","fromCatalog":false},"name":"ltx-video-0-9-6-round-robin-<ROUND_ROBIN_INDEX>","provider":{"region":"us-east-1","vendor":"aws"},"tags":[""],"type":"protected"}' -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_HF_TOKEN>"
```
#### Running the gateway scheduler
```bash
# load the environment
# (if you haven't done it already for this shell session)
source .python_venv/bin/activate
PRODUCT_NAME="TikSlop" \
MAX_NODES="3" \
MAINTENANCE_MODE=false \
HF_TOKEN="<USE YOUR OWN HF TOKEN>" \
SECRET_TOKEN="<USE YOUR OWN TIKSLOP SECRET>" \
VIDEO_ROUND_ROBIN_SERVER_1="https:/<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
VIDEO_ROUND_ROBIN_SERVER_2="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
VIDEO_ROUND_ROBIN_SERVER_3="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
VIDEO_ROUND_ROBIN_SERVER_4="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
VIDEO_ROUND_ROBIN_SERVER_5="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
VIDEO_ROUND_ROBIN_SERVER_6="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
HF_IMAGE_MODEL="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
HF_TEXT_MODEL="https://<USE YOUR OWN SERVER>.endpoints.huggingface.cloud" \
python3 api.py
```
### Run the client (web)
```bash
# For local development with default configuration
flutter run --dart-define=CONFIG_PATH=assets/config/tikslop.yaml -d chrome
# For production build to be deployed on a server
flutter build web --dart-define=CONFIG_PATH=assets/config/tikslop.yaml
```
### WebSocket Connection
The application automatically determines the WebSocket URL:
1. **Web Platform**:
- Automatically uses the same host that serves the web app
- Handles HTTP/HTTPS protocol correctly (ws/wss)
- No configuration needed for deployment
2. **Native Platforms**:
- Production: Automatically uses `wss://tikslop.com/ws` when built with production flag
- Development: Uses `ws://localhost:8080/ws` by default
- Custom: Can override with `API_WS_URL` environment variable (highest priority)
#### Production Native Build
For production builds (connecting to tikslop.com):
```bash
flutter build apk --dart-define=CONFIG_PATH=assets/config/tikslop.yaml --dart-define=PRODUCTION_MODE=true
```
#### Custom API Server
For connecting to a different server:
```bash
flutter build apk --dart-define=CONFIG_PATH=assets/config/tikslop.yaml --dart-define=API_WS_URL=ws://custom-api.example.com/ws
```
Note: The `API_WS_URL` parameter takes precedence over the production setting.
|