Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fixes to Gradio App. Check if CUDA is present, before asking for CUDA device name
Browse files
app.py
CHANGED
@@ -12,8 +12,10 @@ logging.set_verbosity_warning()
|
|
12 |
|
13 |
config = Config(default="./config.yaml")
|
14 |
|
15 |
-
|
16 |
-
print(f"CUDA
|
|
|
|
|
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,
|