mgyigit commited on
Commit
7db6b02
·
verified ·
1 Parent(s): fae9c1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -92,8 +92,8 @@ def run_inference(mode: str, model_name: str, num_molecules: int, seed_num: str,
92
  else:
93
  # Classical Generation mode
94
  config.sample_num = num_molecules
95
- if config.sample_num > 200:
96
- raise gr.Error("You have requested to generate more than the allowed limit of 200 molecules. Please reduce your request to 200 or fewer.")
97
  if seed_num is None or seed_num.strip() == "":
98
  config.seed = random.randint(0, 10000)
99
  else:
@@ -276,11 +276,11 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
276
 
277
  num_molecules = gr.Slider(
278
  minimum=10,
279
- maximum=200,
280
  value=100,
281
  step=10,
282
  label="Number of Molecules to Generate",
283
- info="This space runs on a CPU, which may result in slower performance. Generating 100 molecules takes approximately 6 minutes. Therefore, we set a 200-molecule cap."
284
  )
285
 
286
  seed_num = gr.Textbox(
@@ -359,7 +359,7 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
359
  # Set up the click actions for each tab.
360
  classical_submit.click(
361
  run_inference,
362
- inputs=[gr.State("Generate Molecules"), model_name, num_molecules, seed_num, gr.State("")],
363
  outputs=[
364
  image_output,
365
  file_download,
@@ -368,10 +368,10 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
368
  ],
369
  api_name="inference_classical"
370
  )
371
-
372
  custom_submit.click(
373
  run_inference,
374
- inputs=[gr.State("Custom Input SMILES"), model_name_custom, gr.State(0), gr.State(""), custom_smiles],
375
  outputs=[
376
  image_output_custom,
377
  file_download_custom,
 
92
  else:
93
  # Classical Generation mode
94
  config.sample_num = num_molecules
95
+ if config.sample_num > 250:
96
+ raise gr.Error("You have requested to generate more than the allowed limit of 250 molecules. Please reduce your request to 250 or fewer.")
97
  if seed_num is None or seed_num.strip() == "":
98
  config.seed = random.randint(0, 10000)
99
  else:
 
276
 
277
  num_molecules = gr.Slider(
278
  minimum=10,
279
+ maximum=250,
280
  value=100,
281
  step=10,
282
  label="Number of Molecules to Generate",
283
+ info="This space runs on a CPU, which may result in slower performance. Generating 200 molecules takes approximately 6 minutes. Therefore, we set a 250-molecule cap."
284
  )
285
 
286
  seed_num = gr.Textbox(
 
359
  # Set up the click actions for each tab.
360
  classical_submit.click(
361
  run_inference,
362
+ inputs=[gr.Variable("Generate Molecules"), model_name, num_molecules, seed_num, gr.Textbox.update(value="")],
363
  outputs=[
364
  image_output,
365
  file_download,
 
368
  ],
369
  api_name="inference_classical"
370
  )
371
+
372
  custom_submit.click(
373
  run_inference,
374
+ inputs=[gr.Variable("Custom Input SMILES"), model_name_custom, 0, gr.Textbox.update(value=""), custom_smiles],
375
  outputs=[
376
  image_output_custom,
377
  file_download_custom,