abdullahsamra commited on
Commit
72022d5
·
verified ·
1 Parent(s): 9c53a2c

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +35 -14
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -192,7 +192,7 @@ def generate_job_demo(num_molecules, return_top_k, docking_mode):
192
  CPU demo generation endpoint.
193
 
194
  This does not run live REINVENT generation.
195
- It returns a backend-style generation job response using the packaged example rows,
196
  so frontend/filter/backend teams can test JSON + CSV + job history behavior.
197
  """
198
  job_id = f"gen_{uuid.uuid4().hex[:8]}"
@@ -232,6 +232,21 @@ def generate_job_demo(num_molecules, return_top_k, docking_mode):
232
  csv_path = output_dir / f"{job_id}_results.csv"
233
  df.to_csv(csv_path, index=False)
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  response = {
236
  "job_id": job_id,
237
  "status": "completed",
@@ -255,7 +270,7 @@ def generate_job_demo(num_molecules, return_top_k, docking_mode):
255
  ],
256
  }
257
 
258
- return df, response, str(csv_path)
259
 
260
 
261
  loaded_ok, loaded_msg = download_bundle_light()
@@ -310,16 +325,20 @@ Important:
310
  """
311
  This tab demonstrates the expected backend behavior for generation jobs.
312
 
313
- It returns:
314
-
315
- - job_id
316
- - status
317
- - summary
318
- - results JSON
319
- - downloadable CSV file
320
-
321
  Important:
322
  This CPU Space does not run live REINVENT generation. It uses packaged example rows to let frontend, filters, and backend test the full response format.
 
 
 
 
 
 
 
 
 
 
 
 
323
  """
324
  )
325
 
@@ -343,16 +362,18 @@ This CPU Space does not run live REINVENT generation. It uses packaged example r
343
 
344
  gen_btn = gr.Button("Generate Job Demo")
345
 
346
- gen_table = gr.Dataframe(label="Generated results table")
347
- gen_json = gr.JSON(label="Backend-style generation JSON")
 
348
  gen_file = gr.File(label="Download CSV")
349
 
350
  gen_btn.click(
351
  generate_job_demo,
352
  inputs=[gen_num_molecules, gen_return_top_k, gen_docking_mode],
353
- outputs=[gen_table, gen_json, gen_file],
354
  )
355
-
 
356
  with gr.Tab("Example Generate Response"):
357
  gr.Markdown(
358
  """
 
192
  CPU demo generation endpoint.
193
 
194
  This does not run live REINVENT generation.
195
+ It returns a backend-style generation job response using packaged example rows,
196
  so frontend/filter/backend teams can test JSON + CSV + job history behavior.
197
  """
198
  job_id = f"gen_{uuid.uuid4().hex[:8]}"
 
232
  csv_path = output_dir / f"{job_id}_results.csv"
233
  df.to_csv(csv_path, index=False)
234
 
235
+ job_summary = {
236
+ "job_id": job_id,
237
+ "status": "completed",
238
+ "mode": "generate_job_cpu_demo",
239
+ "created_at": created_at,
240
+ "preset": "egfr_generator",
241
+ "docking_mode": docking_mode,
242
+ "num_requested": num_molecules,
243
+ "num_generated": len(rows),
244
+ "num_returned": len(clean_rows),
245
+ "download_csv_file": str(csv_path),
246
+ "live_generation": False,
247
+ "note": "CPU demo uses packaged example rows. Live REINVENT generation is not executed in this Space version."
248
+ }
249
+
250
  response = {
251
  "job_id": job_id,
252
  "status": "completed",
 
270
  ],
271
  }
272
 
273
+ return job_summary, df, response, str(csv_path)
274
 
275
 
276
  loaded_ok, loaded_msg = download_bundle_light()
 
325
  """
326
  This tab demonstrates the expected backend behavior for generation jobs.
327
 
 
 
 
 
 
 
 
 
328
  Important:
329
  This CPU Space does not run live REINVENT generation. It uses packaged example rows to let frontend, filters, and backend test the full response format.
330
+
331
+ The output is split into 4 parts:
332
+
333
+ 1. Job summary: job-level metadata such as job_id, status, preset, and summary.
334
+ 2. Generated results table: molecule-level rows only.
335
+ 3. Backend-style generation JSON: full response containing job metadata + results.
336
+ 4. Download CSV: downloadable file for the same molecule-level results.
337
+
338
+ In the real backend:
339
+ - The frontend should consume the JSON.
340
+ - The user can optionally download the CSV.
341
+ - The backend should store job history using job_id/status/created_at.
342
  """
343
  )
344
 
 
362
 
363
  gen_btn = gr.Button("Generate Job Demo")
364
 
365
+ gen_summary = gr.JSON(label="Job summary")
366
+ gen_table = gr.Dataframe(label="Generated molecule results table")
367
+ gen_json = gr.JSON(label="Full backend-style generation JSON")
368
  gen_file = gr.File(label="Download CSV")
369
 
370
  gen_btn.click(
371
  generate_job_demo,
372
  inputs=[gen_num_molecules, gen_return_top_k, gen_docking_mode],
373
+ outputs=[gen_summary, gen_table, gen_json, gen_file],
374
  )
375
+
376
+
377
  with gr.Tab("Example Generate Response"):
378
  gr.Markdown(
379
  """