Spaces:
Paused
Paused
fix: replace gdown with hf_hub_download for dataset file retrieval
Browse filesFiles changed (2)
- ProtHGT_app.py+3-1
- run_prothgt_app.py+17-5
319 unmodified lines320321322323324325326327319 unmodified linesst.warning("⚠️ Due to memory and computational constraints, the maximum number of proteins that can be processed at once is limited to 100 proteins. For larger datasets, please consider running the model locally using our [GitHub repository](https://github.com/HUBioDataLab/ProtHGT).")if st.session_state.submitted:with st.spinner("Generating predictions..."):# Generate predictions only if not already in session stateif st.session_state.predictions_df is None:319 unmodified lines320321322323324325326327328329319 unmodified linesst.warning("⚠️ Due to memory and computational constraints, the maximum number of proteins that can be processed at once is limited to 100 proteins. For larger datasets, please consider running the model locally using our [GitHub repository](https://github.com/HUBioDataLab/ProtHGT).")if st.session_state.submitted:kg_path = "data/prothgt-kg.pt"first_run = not os.path.exists(kg_path)with st.spinner("Downloading dataset files for the first time, this may take a few minutes..." if first_run else "Generating predictions..."):# Generate predictions only if not already in session stateif st.session_state.predictions_df is None:
53 unmodified lines54555657585960153 unmodified lines21421521621721821922022122222322422522622753 unmodified linesimport pandas as pdimport yamlfrom datasets import load_datasetimport gdownimport copyimport jsonimport gzip153 unmodified lines# Load dataset once# heterodata = load_dataset('HUBioDataLab/ProtHGT-KG', data_files="prothgt-kg.json.gz")print('Loading data...')file_id = "18u1o2sm8YjMo9joFw4Ilwvg0-rUU0PXK"output = "data/prothgt-kg.pt"if not os.path.exists(output):try:url = f"https://drive.google.com/uc?id={file_id}"print(f"Downloading file from {url}...")gdown.download(url, output, quiet=False, fuzzy=True)print(f"File downloaded to {output}")except Exception as e:print(f"Error downloading file: {e}")53 unmodified lines545556575859606162153 unmodified lines21621721821922022122222322422522622722822923023123223323423523623723823953 unmodified linesimport pandas as pdimport yamlfrom datasets import load_dataset# import gdownimport shutilfrom huggingface_hub import hf_hub_downloadimport copyimport jsonimport gzip153 unmodified lines# Load dataset once# heterodata = load_dataset('HUBioDataLab/ProtHGT-KG', data_files="prothgt-kg.json.gz")print('Loading data...')# file_id = "18u1o2sm8YjMo9joFw4Ilwvg0-rUU0PXK"output = "data/prothgt-kg.pt"if not os.path.exists(output):try:# url = f"https://drive.google.com/uc?id={file_id}"# print(f"Downloading file from {url}...")# gdown.download(url, output, quiet=False)# print(f"File downloaded to {output}")cached_path = hf_hub_download(repo_id="HUBioDataLab/ProtHGT",filename="knowledge_graphs/prothgt-kg.pt",repo_type="dataset",)output = "data/prothgt-kg.pt"os.makedirs("data", exist_ok=True)shutil.copy(cached_path, output)print(f"File downloaded to {output}")except Exception as e:print(f"Error downloading file: {e}")
ProtHGT_app.py+3-1
run_prothgt_app.py+17-5