Spaces:
Running
on
L4
Running
on
L4
fix: identification of official demo instance
Browse files
app.py
CHANGED
@@ -6,7 +6,10 @@ from torch import cuda
|
|
6 |
|
7 |
from detikzify.webui import build_ui, make_light, BANNER
|
8 |
|
9 |
-
|
|
|
|
|
|
|
10 |
center = ".gradio-container {text-align: center}"
|
11 |
with gr.Blocks(css=center, theme=make_light(gr.themes.Soft()), title="DeTikZify") as demo:
|
12 |
badge = "https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg"
|
@@ -21,8 +24,7 @@ if is_public:=(getenv("SPACE_ID") == "nllg/DeTikZify") and not cuda.is_available
|
|
21 |
else:
|
22 |
use_big_models = cuda.is_available() and cuda.get_device_properties(0).total_memory > 15835660288
|
23 |
model = f"detikzify-ds-{'7' if use_big_models else '1.3'}b"
|
24 |
-
|
25 |
-
demo = build_ui(lock=is_public, model=model, algorithm=algorithm, light=True).queue()
|
26 |
|
27 |
if __name__ == "__main__":
|
28 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
6 |
|
7 |
from detikzify.webui import build_ui, make_light, BANNER
|
8 |
|
9 |
+
def is_official_demo():
|
10 |
+
return getenv("SPACE_AUTHOR_NAME") == "nllg"
|
11 |
+
|
12 |
+
if is_official_demo() and not cuda.is_available():
|
13 |
center = ".gradio-container {text-align: center}"
|
14 |
with gr.Blocks(css=center, theme=make_light(gr.themes.Soft()), title="DeTikZify") as demo:
|
15 |
badge = "https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg"
|
|
|
24 |
else:
|
25 |
use_big_models = cuda.is_available() and cuda.get_device_properties(0).total_memory > 15835660288
|
26 |
model = f"detikzify-ds-{'7' if use_big_models else '1.3'}b"
|
27 |
+
demo = build_ui(lock=is_official_demo(), model=model, light=True).queue()
|
|
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|