app
Browse files
app.py
CHANGED
@@ -19,6 +19,7 @@ import tempfile
|
|
19 |
import shutil
|
20 |
from Bio import PDB
|
21 |
from gradio_molecule3d import Molecule3D
|
|
|
22 |
|
23 |
EXAMPLE_PATH = './examples/example.json'
|
24 |
example_json=[{'sequences': [{'proteinChain': {'sequence': 'MAEVIRSSAFWRSFPIFEEFDSETLCELSGIASYRKWSAGTVIFQRGDQGDYMIVVVSGRIKLSLFTPQGRELMLRQHEAGALFGEMALLDGQPRSADATAVTAAEGYVIGKKDFLALITQRPKTAEAVIRFLCAQLRDTTDRLETIALYDLNARVARFFLATLRQIHGSEMPQSANLRLTLSQTDIASILGASRPKVNRAILSLEESGAIKRADGIICCNVGRLLSIADPEEDLEHHHHHHHH', 'count': 2}}, {'dnaSequence': {'sequence': 'CTAGGTAACATTACTCGCG', 'count': 2}}, {'dnaSequence': {'sequence': 'GCGAGTAATGTTAC', 'count': 2}}, {'ligand': {'ligand': 'CCD_PCG', 'count': 2}}], 'name': '7pzb_need_search_msa'}]
|
@@ -145,7 +146,6 @@ def plot_3d(pred_loader):
|
|
145 |
|
146 |
return temp_pdb_path, cif_path
|
147 |
|
148 |
-
|
149 |
def parse_json_input(json_data: List[Dict]) -> Dict:
|
150 |
"""Convert Protenix JSON format to UI-friendly structure"""
|
151 |
components = {
|
@@ -209,7 +209,8 @@ def create_protenix_json(input_data: Dict) -> List[Dict]:
|
|
209 |
}]
|
210 |
|
211 |
|
212 |
-
|
|
|
213 |
def predict_structure(input_collector: dict):
|
214 |
"""Handle both input types"""
|
215 |
os.makedirs("./output", exist_ok=True)
|
@@ -286,6 +287,7 @@ runner = InferenceRunner(configs)
|
|
286 |
add_watermark = gr.Checkbox(label="Add Watermark", value=True)
|
287 |
add_watermark1 = gr.Checkbox(label="Add Watermark", value=True)
|
288 |
|
|
|
289 |
with gr.Blocks(title="FoldMark", css=custom_css) as demo:
|
290 |
with gr.Row():
|
291 |
# Use a Column to align the logo and title horizontally
|
@@ -448,6 +450,8 @@ with gr.Blocks(title="FoldMark", css=custom_css) as demo:
|
|
448 |
outputs=[view3d, confidence_plot_image, cif_file]
|
449 |
)
|
450 |
|
|
|
|
|
451 |
def is_watermarked(file):
|
452 |
# Generate a unique subdirectory and filename
|
453 |
unique_id = str(uuid.uuid4())
|
|
|
19 |
import shutil
|
20 |
from Bio import PDB
|
21 |
from gradio_molecule3d import Molecule3D
|
22 |
+
import spaces # Import spaces for ZeroGPU compatibility
|
23 |
|
24 |
EXAMPLE_PATH = './examples/example.json'
|
25 |
example_json=[{'sequences': [{'proteinChain': {'sequence': 'MAEVIRSSAFWRSFPIFEEFDSETLCELSGIASYRKWSAGTVIFQRGDQGDYMIVVVSGRIKLSLFTPQGRELMLRQHEAGALFGEMALLDGQPRSADATAVTAAEGYVIGKKDFLALITQRPKTAEAVIRFLCAQLRDTTDRLETIALYDLNARVARFFLATLRQIHGSEMPQSANLRLTLSQTDIASILGASRPKVNRAILSLEESGAIKRADGIICCNVGRLLSIADPEEDLEHHHHHHHH', 'count': 2}}, {'dnaSequence': {'sequence': 'CTAGGTAACATTACTCGCG', 'count': 2}}, {'dnaSequence': {'sequence': 'GCGAGTAATGTTAC', 'count': 2}}, {'ligand': {'ligand': 'CCD_PCG', 'count': 2}}], 'name': '7pzb_need_search_msa'}]
|
|
|
146 |
|
147 |
return temp_pdb_path, cif_path
|
148 |
|
|
|
149 |
def parse_json_input(json_data: List[Dict]) -> Dict:
|
150 |
"""Convert Protenix JSON format to UI-friendly structure"""
|
151 |
components = {
|
|
|
209 |
}]
|
210 |
|
211 |
|
212 |
+
@torch.inference_mode()
|
213 |
+
@spaces.GPU(duration=120) # Specify a duration to avoid timeout
|
214 |
def predict_structure(input_collector: dict):
|
215 |
"""Handle both input types"""
|
216 |
os.makedirs("./output", exist_ok=True)
|
|
|
287 |
add_watermark = gr.Checkbox(label="Add Watermark", value=True)
|
288 |
add_watermark1 = gr.Checkbox(label="Add Watermark", value=True)
|
289 |
|
290 |
+
|
291 |
with gr.Blocks(title="FoldMark", css=custom_css) as demo:
|
292 |
with gr.Row():
|
293 |
# Use a Column to align the logo and title horizontally
|
|
|
450 |
outputs=[view3d, confidence_plot_image, cif_file]
|
451 |
)
|
452 |
|
453 |
+
@torch.inference_mode()
|
454 |
+
@spaces.GPU(duration=60)
|
455 |
def is_watermarked(file):
|
456 |
# Generate a unique subdirectory and filename
|
457 |
unique_id = str(uuid.uuid4())
|