Skip to content

Instantly share code, notes, and snippets.

@adamelliotfields
Created August 31, 2024 17:26
Show Gist options
  • Save adamelliotfields/f6eb46468949fde6b3f246d7ecaf5c00 to your computer and use it in GitHub Desktop.
Save adamelliotfields/f6eb46468949fde6b3f246d7ecaf5c00 to your computer and use it in GitHub Desktop.
Import a Python module from a Hugging Face repo
# https://hf.co/spaces/briaai/BRIA-2.3-T5/blob/main/app.py
import sys
from huggingface_hub import snapshot_download
repo_path = snapshot_download(repo_id="org/repo")
sys.path.append(repo_path)
from my_module import my_function # my_module.py
from my_other_module import my_other_function # my_other_module.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment