Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -81,7 +81,9 @@ def save_interesting_log(smiles, properties, suggested_properties):
|
|
81 |
}
|
82 |
writer.writerow(log_data)
|
83 |
|
|
|
84 |
def generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps):
|
|
|
85 |
model, device = model_state
|
86 |
|
87 |
properties = [CH4, CO2, H2, N2, O2]
|
@@ -94,7 +96,7 @@ def generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_ti
|
|
94 |
nan_message = "The following gas properties were treated as NaN: "
|
95 |
nan_gases = [gas for gas, prop in zip(all_properties, properties) if prop is None]
|
96 |
nan_message += ", ".join(nan_gases) if nan_gases else "None"
|
97 |
-
|
98 |
num_nodes = None if num_nodes == 0 else num_nodes
|
99 |
|
100 |
for _ in range(repeating_time):
|
@@ -172,8 +174,8 @@ def numpy_to_python(obj):
|
|
172 |
else:
|
173 |
return obj
|
174 |
|
175 |
-
@spaces.GPU
|
176 |
def on_generate(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps):
|
|
|
177 |
result = generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps)
|
178 |
# Check if the generation was successful
|
179 |
if result[0].startswith("**Generated polymer SMILES:**"):
|
|
|
81 |
}
|
82 |
writer.writerow(log_data)
|
83 |
|
84 |
+
@spaces.GPU
|
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')
|
87 |
model, device = model_state
|
88 |
|
89 |
properties = [CH4, CO2, H2, N2, O2]
|
|
|
96 |
nan_message = "The following gas properties were treated as NaN: "
|
97 |
nan_gases = [gas for gas, prop in zip(all_properties, properties) if prop is None]
|
98 |
nan_message += ", ".join(nan_gases) if nan_gases else "None"
|
99 |
+
|
100 |
num_nodes = None if num_nodes == 0 else num_nodes
|
101 |
|
102 |
for _ in range(repeating_time):
|
|
|
174 |
else:
|
175 |
return obj
|
176 |
|
|
|
177 |
def on_generate(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps):
|
178 |
+
print('in on_generate', on_generate)
|
179 |
result = generate_graph(CH4, CO2, H2, N2, O2, guidance_scale, num_nodes, repeating_time, model_state, num_chain_steps, fps)
|
180 |
# Check if the generation was successful
|
181 |
if result[0].startswith("**Generated polymer SMILES:**"):
|