hmarzan commited on
Commit
4954695
1 Parent(s): e0ebf28

Fixes to Gradio App. Check if CUDA is present, before asking for CUDA device name

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -12,8 +12,10 @@ logging.set_verbosity_warning()
12
 
13
  config = Config(default="./config.yaml")
14
 
15
- print(f"Is CUDA available: {torch.cuda.is_available()}")
16
- print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
 
 
17
 
18
  model = DonutModel.from_pretrained(
19
  config.pretrained_model_name_or_path,
 
12
 
13
  config = Config(default="./config.yaml")
14
 
15
+ has_cuda = torch.cuda.is_available()
16
+ print(f"Is CUDA available: {has_cuda}")
17
+ if has_cuda:
18
+ print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
19
 
20
  model = DonutModel.from_pretrained(
21
  config.pretrained_model_name_or_path,