Luigi commited on
Commit
36190e5
Β·
1 Parent(s): 672fcdf

skip cuda if not available

Browse files
Files changed (2) hide show
  1. app.py +7 -3
  2. requirements.txt +2 -1
app.py CHANGED
@@ -4,9 +4,13 @@ import os, sys, importlib.util, re
4
  import gradio as gr
5
  from PIL import Image
6
  import torch
7
- print(f"CUDA available: {torch.cuda.is_available()}")
8
- print(f"CUDA version: {torch.version.cuda}")
9
- print(f"GPU device: {torch.cuda.get_device_name(0)}")
 
 
 
 
10
 
11
  # β€”β€”β€” Monkey-patch mmdet to remove its mmcv-version assertion β€”β€”β€”
12
  spec = importlib.util.find_spec('mmdet')
 
4
  import gradio as gr
5
  from PIL import Image
6
  import torch
7
+
8
+ try:
9
+ print(f"CUDA available: {torch.cuda.is_available()}")
10
+ print(f"CUDA version: {torch.version.cuda}")
11
+ print(f"GPU device: {torch.cuda.get_device_name(0)}")
12
+ except:
13
+ print('CUDA is not available !')
14
 
15
  # β€”β€”β€” Monkey-patch mmdet to remove its mmcv-version assertion β€”β€”β€”
16
  spec = importlib.util.find_spec('mmdet')
requirements.txt CHANGED
@@ -7,4 +7,5 @@ opencv-python
7
  mmengine
8
  mmdet
9
  mmpose
10
- gradio
 
 
7
  mmengine
8
  mmdet
9
  mmpose
10
+ gradio
11
+ requests