Spaces:
Runtime error
Runtime error
File size: 914 Bytes
b7b5e1a 3c8d389 d6277ac 3c8d389 b7b5e1a 0eb9188 b7b5e1a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import gradio as gr
from pathlib import Path
import tempfile
def molstar(output_name):
structure_url = (
f"https://nodata.dev/gradiofold/predictions/{output_name}/prediction.pdb"
)
return f'<iframe style="height: 50rem; width:100%" src="https://nodata.dev/gradiofold/molstar.html?structure-url={structure_url}"/>'
def main(dropdown):
filename = PRECALCULATED_MOLECULES[dropdown]
return molstar(filename)
PRECALCULATED_MOLECULES = {"Covid spike": "ncov-s", "Covid spike (omicron)": "omicron"}
file_input = gr.inputs.File(
file_count="single",
type="file",
label="Send a Fasta file representing the protein",
optional=False,
)
dropdown_input = gr.inputs.Dropdown(
list(PRECALCULATED_MOLECULES.keys()) + ["custom fasta file"]
)
inputs = [dropdown_input]
iface = gr.Interface(fn=main, inputs=inputs, outputs="html")
if __name__ == "__main__":
iface.launch()
|