import json import os local_url = "http://localhost:8888/frontend/" remote_url = "https://cdn.jsdelivr.net/gh/duerrsimon/vue_3dmol_gradio@v.02/" if os.environ.get("GRADIO_LOCAL") is not None: url = local_url else: url = remote_url def viewer_html(path_to_file, name="input", selectionStyle={"color": "greenCarbon", "representation": "cartoon", "multiple": True}, representations={}): ext = path_to_file.split(".")[-1] with open(path_to_file, "r") as f: data = f.read() moldata = {"moldata": [{"data": data, "name": name, "selectionStyle": selectionStyle,"format": ext, "selectable": True, "asFrames":False, "clickable": False}] } # dict to json moldata = json.dumps(moldata) representations = json.dumps(representations) return """