DonImages commited on
Commit
c868357
·
verified ·
1 Parent(s): b5ad11a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -4,6 +4,14 @@ from huggingface_hub import login
4
  import os
5
  import gradio as gr
6
 
 
 
 
 
 
 
 
 
7
  # Retrieve the token from the environment variable
8
  token = os.getenv("HF_TOKEN") # Hugging Face token from the secret
9
  if token:
 
4
  import os
5
  import gradio as gr
6
 
7
+ # Check for GPU availability and set device accordingly
8
+ if torch.cuda.is_available():
9
+ device = "cuda"
10
+ print("GPU is available")
11
+ else:
12
+ device = "cpu"
13
+ print("GPU is not available, using CPU")
14
+
15
  # Retrieve the token from the environment variable
16
  token = os.getenv("HF_TOKEN") # Hugging Face token from the secret
17
  if token: