Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -57,15 +57,6 @@ def _build_yaml(protein_seq: str, ligand_smiles: str) -> str:
|
|
| 57 |
return pyyaml.safe_dump(doc, sort_keys=False)
|
| 58 |
|
| 59 |
|
| 60 |
-
class _SerialFuture:
|
| 61 |
-
def __init__(self, fn, args, kwargs):
|
| 62 |
-
self._fn, self._args, self._kwargs = fn, args, kwargs
|
| 63 |
-
self._done = False
|
| 64 |
-
|
| 65 |
-
def result(self, timeout=None):
|
| 66 |
-
return self._fn(*self._args, **self._kwargs)
|
| 67 |
-
|
| 68 |
-
|
| 69 |
class _SerialExecutor:
|
| 70 |
"""Drop-in for ProcessPoolExecutor that runs tasks inline in the current
|
| 71 |
process. Required on ZeroGPU: the @spaces.GPU worker is a daemonic fork and
|
|
@@ -85,7 +76,14 @@ class _SerialExecutor:
|
|
| 85 |
return False
|
| 86 |
|
| 87 |
def submit(self, fn, *args, **kwargs):
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
def _patch_nesso_multiprocessing():
|
|
|
|
| 57 |
return pyyaml.safe_dump(doc, sort_keys=False)
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
class _SerialExecutor:
|
| 61 |
"""Drop-in for ProcessPoolExecutor that runs tasks inline in the current
|
| 62 |
process. Required on ZeroGPU: the @spaces.GPU worker is a daemonic fork and
|
|
|
|
| 76 |
return False
|
| 77 |
|
| 78 |
def submit(self, fn, *args, **kwargs):
|
| 79 |
+
from concurrent.futures import Future
|
| 80 |
+
|
| 81 |
+
fut = Future()
|
| 82 |
+
try:
|
| 83 |
+
fut.set_result(fn(*args, **kwargs))
|
| 84 |
+
except BaseException as exc: # noqa: BLE001
|
| 85 |
+
fut.set_exception(exc)
|
| 86 |
+
return fut
|
| 87 |
|
| 88 |
|
| 89 |
def _patch_nesso_multiprocessing():
|