Spaces:
Running
Running
import sys | |
root_dir = __file__.rsplit("/", 2)[0] | |
if root_dir not in sys.path: | |
sys.path.append(root_dir) | |
import gradio as gr | |
import os | |
import requests | |
from gradio.themes import * | |
# Build demo | |
with gr.Blocks(title="SaprotHub", fill_width=True) as demo: | |
# models = retrieve_models() | |
# datasets = retrieve_datasets() | |
# print(models) | |
# print(datasets) | |
gr.Label("Subsection of text", visible=True) | |
# subsection_type = gr.Dropdown(models, label="Search models", interactive=True, scale=0) | |
# url = "https://hf-mirror.com/SaProtHub/Model-Thermostability-650M" | |
url = "https://www.uniprot.org/uniprotkb/P05067" | |
url = "https://huggingface.co/SaProtHub/Model-Thermostability-650M" | |
# url = "https://www.baidu.com" | |
response = requests.get(url) | |
# print(response.text) | |
# gr.HTML(response.text) | |
# iframe = f'<iframe srcdoc="{response.text}" width="100%"></iframe>' | |
iframe = f'<iframe src="{url}" width="100%" height="800"></iframe>' | |
# HTML = gr.HTML(open("/root/PycharmProjects/SaprotHub/hub_demo/test.html").read()) | |
HTML = gr.HTML(iframe) | |
if __name__ == '__main__': | |
# Run the demo | |
demo.launch(server_name="0.0.0.0") |