potamides commited on
Commit
75b0163
1 Parent(s): 9eb20d6

feat: check whether we have a GPU or not

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -1,10 +1,13 @@
1
  from os import getenv
2
  from textwrap import dedent
 
3
 
4
  import gradio as gr
5
  from src.automatikz.examples.webui.webui import build_ui, get_banner
6
 
7
- if getenv("SPACE_ID") == "nllg/AutomaTikZ":
 
 
8
  with gr.Blocks(css=".gradio-container {text-align: center}", theme=gr.themes.Soft()) as demo:
9
  badge = "https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg"
10
  link = "https://huggingface.co/spaces/nllg/AutomaTikZ?duplicate=true"
 
1
  from os import getenv
2
  from textwrap import dedent
3
+ from torch import cuda
4
 
5
  import gradio as gr
6
  from src.automatikz.examples.webui.webui import build_ui, get_banner
7
 
8
+ PUBLIC_DEMO = getenv("SPACE_ID") == "nllg/AutomaTikZ"
9
+
10
+ if PUBLIC_DEMO and not cuda.is_available():
11
  with gr.Blocks(css=".gradio-container {text-align: center}", theme=gr.themes.Soft()) as demo:
12
  badge = "https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg"
13
  link = "https://huggingface.co/spaces/nllg/AutomaTikZ?duplicate=true"