CarVizDemo / app.py
rootglitch's picture
Update app.py
f75ef25 verified
raw
history blame
1.01 kB
import os
import sys
from huggingface_hub import hf_hub_download
# Clone repositories correctly
os.system("git clone https://github.com/IDEA-Research/GroundingDINO.git")
os.system("git clone https://github.com/SysCV/sam-hq.git")
# Install dependencies correctly
os.system("pip install -e GroundingDINO")
os.system("pip install -e sam-hq")
# Ensure the repositories are in Python's path
sys.path.append(os.path.join(os.getcwd(), "GroundingDINO"))
sys.path.append(os.path.join(os.getcwd(), "sam-hq"))
# # Download model weights from Hugging Face
# hf_hub_download(repo_id="ShilongLiu/GroundingDINO", filename="groundingdino_swint_ogc.pth", local_dir="GroundingDINO")
# hf_hub_download(repo_id="lkeab/hq-sam", filename="sam_hq_vit_l.pth", local_dir="sam-hq")
# Fetch code from a private repo
code_path = hf_hub_download(
repo_id="rootglitch/CarVizGradioDemo01",
repo_type="space",
filename="app.py",
token=os.environ["HF_TOKEN"],
)
with open(code_path, "r") as f:
code = f.read()
exec(code)