liuganghuggingface commited on
Commit
1ff1c11
·
verified ·
1 Parent(s): a0f6fb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -9
app.py CHANGED
@@ -81,9 +81,9 @@ def save_interesting_log(smiles, properties, suggested_properties):
81
  }
82
  writer.writerow(log_data)
83
 
84
- # @spaces.GPU(duration=60)
85
- @spaces.GPU
86
  def generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps):
 
87
  model, device = model_state
88
 
89
  properties = [CH4, CO2, H2, N2, O2]
@@ -101,13 +101,6 @@ def generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_ti
101
 
102
  for _ in range(repeating_time):
103
  try:
104
- # def generate_func():
105
- # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
106
- # model.to(device)
107
- # print('Before generation, move model to', device)
108
- # return generated_molecule, img_list
109
- # generated_molecule, img_list = generate_func()
110
-
111
  model.to(device)
112
  generated_molecule, img_list = model.generate(properties, device=device, guide_scale=guidance_scale, num_nodes=num_nodes, number_chain_steps=num_chain_steps)
113
 
 
81
  }
82
  writer.writerow(log_data)
83
 
84
+ @spaces.GPU(duration=60)
 
85
  def generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps):
86
+ print('in generate graph', torch.device("cuda" if torch.cuda.is_available() else "cpu"))
87
  model, device = model_state
88
 
89
  properties = [CH4, CO2, H2, N2, O2]
 
101
 
102
  for _ in range(repeating_time):
103
  try:
 
 
 
 
 
 
 
104
  model.to(device)
105
  generated_molecule, img_list = model.generate(properties, device=device, guide_scale=guidance_scale, num_nodes=num_nodes, number_chain_steps=num_chain_steps)
106