Luigi Piccinelli commited on
Commit
595c64b
·
1 Parent(s): 919cfa0

add zero gpu

Browse files
Files changed (3) hide show
  1. app.py +4 -1
  2. requirements.txt +1 -0
  3. requirements_demo.txt +1 -0
app.py CHANGED
@@ -12,6 +12,7 @@ from datetime import datetime
12
  from math import pi
13
 
14
  import gradio as gr
 
15
  import numpy as np
16
  import torch
17
  import trimesh
@@ -89,6 +90,7 @@ def instantiate_camera(camera_name, params, device):
89
  return eval(camera_name)(params=torch.tensor(params).float()).to(device)
90
 
91
 
 
92
  def run_model(target_dir, model_name, camera_name, params, efficiency):
93
 
94
  print("Instantiating model and camera...")
@@ -112,6 +114,7 @@ def run_model(target_dir, model_name, camera_name, params, efficiency):
112
  return outputs
113
 
114
 
 
115
  def gradio_demo(
116
  target_dir,
117
  model_name,
@@ -813,4 +816,4 @@ if __name__ == "__main__":
813
  outputs=[fx, fy, cx, cy, k1, k2, k3, k4, k5, k6, t1, t2, hfov],
814
  )
815
 
816
- demo.queue(max_size=20).launch(show_error=True, share=True, ssr_mode=False)
 
12
  from math import pi
13
 
14
  import gradio as gr
15
+ import spaces
16
  import numpy as np
17
  import torch
18
  import trimesh
 
90
  return eval(camera_name)(params=torch.tensor(params).float()).to(device)
91
 
92
 
93
+ @spaces.GPU(duration=120)
94
  def run_model(target_dir, model_name, camera_name, params, efficiency):
95
 
96
  print("Instantiating model and camera...")
 
114
  return outputs
115
 
116
 
117
+ @spaces.GPU(duration=120)
118
  def gradio_demo(
119
  target_dir,
120
  model_name,
 
816
  outputs=[fx, fy, cx, cy, k1, k2, k3, k4, k5, k6, t1, t2, hfov],
817
  )
818
 
819
+ demo.queue(max_size=20).launch(show_error=True, ssr_mode=False)
requirements.txt CHANGED
@@ -65,6 +65,7 @@ sentry-sdk
65
  setproctitle
66
  six
67
  smmap
 
68
  sympy
69
  tables
70
  tabulate
 
65
  setproctitle
66
  six
67
  smmap
68
+ spaces
69
  sympy
70
  tables
71
  tabulate
requirements_demo.txt CHANGED
@@ -65,6 +65,7 @@ sentry-sdk
65
  setproctitle
66
  six
67
  smmap
 
68
  sympy
69
  tables
70
  tabulate
 
65
  setproctitle
66
  six
67
  smmap
68
+ spaces
69
  sympy
70
  tables
71
  tabulate