nikigoli commited on
Commit
578e705
1 Parent(s): f1d1aa1

Trying to enable GPU

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,7 +27,7 @@ print("Current working directory:", cwd)
27
  @spaces.GPU
28
  # Installing dependencies not in requirements.txt
29
  def install_add_dependencies():
30
- with open('./startup.sh', 'rb') as file:
31
  script = file.read()
32
  return call(script, shell=True)
33
 
@@ -38,7 +38,7 @@ def build_custom_prompter():
38
 
39
  build_custom_prompter()
40
  from gradio_image_prompter import ImagePrompter
41
- #install_add_dependencies()
42
 
43
  class AppSteps(Enum):
44
  JUST_TEXT = 1
@@ -157,7 +157,7 @@ def build_model_and_transforms(args):
157
  parser = argparse.ArgumentParser("Counting Application", parents=[get_args_parser()])
158
  args = parser.parse_args()
159
  if torch.cuda.is_available():
160
- args.device = torch.device('cpu')
161
  else:
162
  args.device = torch.device('cpu')
163
  model, transform = build_model_and_transforms(args)
 
27
  @spaces.GPU
28
  # Installing dependencies not in requirements.txt
29
  def install_add_dependencies():
30
+ with open('./build_ops.sh', 'rb') as file:
31
  script = file.read()
32
  return call(script, shell=True)
33
 
 
38
 
39
  build_custom_prompter()
40
  from gradio_image_prompter import ImagePrompter
41
+ install_add_dependencies()
42
 
43
  class AppSteps(Enum):
44
  JUST_TEXT = 1
 
157
  parser = argparse.ArgumentParser("Counting Application", parents=[get_args_parser()])
158
  args = parser.parse_args()
159
  if torch.cuda.is_available():
160
+ args.device = torch.device('cuda')
161
  else:
162
  args.device = torch.device('cpu')
163
  model, transform = build_model_and_transforms(args)