add decorators to visualizers instead of main function
Browse files
app.py
CHANGED
@@ -225,7 +225,8 @@ def run_structure_prediction(protein: ESMProtein, temperature: float, num_steps:
|
|
225 |
except Exception as e:
|
226 |
print(f"Error during structure prediction: {str(e)}")
|
227 |
return None
|
228 |
-
|
|
|
229 |
def align_after_prediction(protein: ESMProtein, structure_prediction: ESMProtein) -> tuple[ESMProtein, float]:
|
230 |
if structure_prediction is None:
|
231 |
return None, float('inf')
|
@@ -261,7 +262,8 @@ def align_after_prediction(protein: ESMProtein, structure_prediction: ESMProtein
|
|
261 |
except Exception as e:
|
262 |
print(f"Unexpected error during alignment: {str(e)}")
|
263 |
return None, float('inf')
|
264 |
-
|
|
|
265 |
def visualize_after_pred(protein: ESMProtein, aligned: ESMProtein):
|
266 |
if aligned is None:
|
267 |
return None
|
@@ -284,6 +286,7 @@ def protein_to_pdb(protein: ESMProtein):
|
|
284 |
pdb_str += f"ATOM {i*37+j+1:5d} {atom:3s} {aa:3s} A{i+1:4d} {x:8.3f}{y:8.3f}{z:8.3f}\n"
|
285 |
return pdb_str
|
286 |
|
|
|
287 |
def prediction_visualization(pdb_file, num_runs: int, noise_level: float, num_frames: int, temperature: float, num_steps: int, progress=gr.Progress()):
|
288 |
protein = get_protein(pdb_file)
|
289 |
runs = []
|
@@ -310,7 +313,6 @@ def prediction_visualization(pdb_file, num_runs: int, noise_level: float, num_fr
|
|
310 |
view_data = visualize_after_pred(protein, best_aligned[1])
|
311 |
return view_data, f"Best cRMSD: {best_aligned[0]:.4f}"
|
312 |
|
313 |
-
@spaces.GPU
|
314 |
def run_prediction(pdb_file, num_runs, noise_level, num_frames, temperature, num_steps, progress=gr.Progress()):
|
315 |
try:
|
316 |
if pdb_file is None:
|
|
|
225 |
except Exception as e:
|
226 |
print(f"Error during structure prediction: {str(e)}")
|
227 |
return None
|
228 |
+
|
229 |
+
@spaces.GPU
|
230 |
def align_after_prediction(protein: ESMProtein, structure_prediction: ESMProtein) -> tuple[ESMProtein, float]:
|
231 |
if structure_prediction is None:
|
232 |
return None, float('inf')
|
|
|
262 |
except Exception as e:
|
263 |
print(f"Unexpected error during alignment: {str(e)}")
|
264 |
return None, float('inf')
|
265 |
+
|
266 |
+
@spaces.GPU
|
267 |
def visualize_after_pred(protein: ESMProtein, aligned: ESMProtein):
|
268 |
if aligned is None:
|
269 |
return None
|
|
|
286 |
pdb_str += f"ATOM {i*37+j+1:5d} {atom:3s} {aa:3s} A{i+1:4d} {x:8.3f}{y:8.3f}{z:8.3f}\n"
|
287 |
return pdb_str
|
288 |
|
289 |
+
@spaces.GPU
|
290 |
def prediction_visualization(pdb_file, num_runs: int, noise_level: float, num_frames: int, temperature: float, num_steps: int, progress=gr.Progress()):
|
291 |
protein = get_protein(pdb_file)
|
292 |
runs = []
|
|
|
313 |
view_data = visualize_after_pred(protein, best_aligned[1])
|
314 |
return view_data, f"Best cRMSD: {best_aligned[0]:.4f}"
|
315 |
|
|
|
316 |
def run_prediction(pdb_file, num_runs, noise_level, num_frames, temperature, num_steps, progress=gr.Progress()):
|
317 |
try:
|
318 |
if pdb_file is None:
|