Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,7 +281,7 @@ def flex_seq(input_seq, input_file):
|
|
| 281 |
print("Falling back to CPU execution. This may take a while...")
|
| 282 |
return core_flex_seq(input_seq, input_file, force_cpu=True)
|
| 283 |
|
| 284 |
-
def core_flex_3d(input_file):
|
| 285 |
if not input_file:
|
| 286 |
return None, "Provide a file or a input sequence"
|
| 287 |
|
|
@@ -467,23 +467,23 @@ def core_flex_3d(input_file):
|
|
| 467 |
return output_files, output_message, output_files_enm
|
| 468 |
|
| 469 |
@spaces.GPU
|
| 470 |
-
def flex_3d_gpu(
|
| 471 |
"""Wrapper that requests ZeroGPU."""
|
| 472 |
-
return core_flex_3d(
|
| 473 |
|
| 474 |
-
def flex_3d(
|
| 475 |
"""
|
| 476 |
Main entry point for Gradio.
|
| 477 |
Tries GPU first, falls back to CPU if quota is exceeded or time limit runs out.
|
| 478 |
"""
|
| 479 |
try:
|
| 480 |
print("Attempting to run on ZeroGPU...")
|
| 481 |
-
return flex_3d_gpu(
|
| 482 |
except Exception as e:
|
| 483 |
# ZeroGPU exceptions (like SpaceTaskError or timeouts) are caught here
|
| 484 |
print(f"ZeroGPU failed or timed out. Reason: {e}")
|
| 485 |
print("Falling back to CPU execution. This may take longer...")
|
| 486 |
-
return core_flex_3d(
|
| 487 |
|
| 488 |
|
| 489 |
def rescale_bfactors(pdb_file):
|
|
|
|
| 281 |
print("Falling back to CPU execution. This may take a while...")
|
| 282 |
return core_flex_seq(input_seq, input_file, force_cpu=True)
|
| 283 |
|
| 284 |
+
def core_flex_3d(input_file, force_cpu=False):
|
| 285 |
if not input_file:
|
| 286 |
return None, "Provide a file or a input sequence"
|
| 287 |
|
|
|
|
| 467 |
return output_files, output_message, output_files_enm
|
| 468 |
|
| 469 |
@spaces.GPU
|
| 470 |
+
def flex_3d_gpu(input_file):
|
| 471 |
"""Wrapper that requests ZeroGPU."""
|
| 472 |
+
return core_flex_3d(input_file, force_cpu=False)
|
| 473 |
|
| 474 |
+
def flex_3d(input_file):
|
| 475 |
"""
|
| 476 |
Main entry point for Gradio.
|
| 477 |
Tries GPU first, falls back to CPU if quota is exceeded or time limit runs out.
|
| 478 |
"""
|
| 479 |
try:
|
| 480 |
print("Attempting to run on ZeroGPU...")
|
| 481 |
+
return flex_3d_gpu(input_file)
|
| 482 |
except Exception as e:
|
| 483 |
# ZeroGPU exceptions (like SpaceTaskError or timeouts) are caught here
|
| 484 |
print(f"ZeroGPU failed or timed out. Reason: {e}")
|
| 485 |
print("Falling back to CPU execution. This may take longer...")
|
| 486 |
+
return core_flex_3d(input_file, force_cpu=True)
|
| 487 |
|
| 488 |
|
| 489 |
def rescale_bfactors(pdb_file):
|