Spaces:
Running on Zero
Running on Zero
Commit ·
12aeaec
1
Parent(s): 2aa1001
Use ZeroGPU SDK detection for generation concurrency
Browse files- gradio_app.py +2 -1
gradio_app.py
CHANGED
|
@@ -14,6 +14,7 @@ import time
|
|
| 14 |
from collections import OrderedDict
|
| 15 |
|
| 16 |
import spaces
|
|
|
|
| 17 |
from dataclasses import asdict, dataclass, replace
|
| 18 |
from functools import partial
|
| 19 |
from importlib.resources import files
|
|
@@ -864,7 +865,7 @@ def build_app(
|
|
| 864 |
[checkpoint] + fields,
|
| 865 |
[gallery, status, last_generation],
|
| 866 |
# ZeroGPU isolates GPU tasks in workers; local runs share the pipeline.
|
| 867 |
-
concurrency_limit=32 if
|
| 868 |
concurrency_id="model",
|
| 869 |
api_name="generate",
|
| 870 |
)
|
|
|
|
| 14 |
from collections import OrderedDict
|
| 15 |
|
| 16 |
import spaces
|
| 17 |
+
from spaces.config import Config as SpacesConfig
|
| 18 |
from dataclasses import asdict, dataclass, replace
|
| 19 |
from functools import partial
|
| 20 |
from importlib.resources import files
|
|
|
|
| 865 |
[checkpoint] + fields,
|
| 866 |
[gallery, status, last_generation],
|
| 867 |
# ZeroGPU isolates GPU tasks in workers; local runs share the pipeline.
|
| 868 |
+
concurrency_limit=32 if SpacesConfig.zero_gpu else 1,
|
| 869 |
concurrency_id="model",
|
| 870 |
api_name="generate",
|
| 871 |
)
|