Skip to content

Commit

Permalink
feat: add function get_image to fetch git-lfs urls
Browse files Browse the repository at this point in the history
  • Loading branch information
qLunar committed Oct 2, 2023
1 parent 141a3a4 commit 0ebbd68
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions chiya/utils/lfs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from pathlib import Path
import inspect

from chiya import config

def get_image(imgname: str) -> str:
"""
Takes the name of the image and grabs the filename of the function using the inspect module.
Args:
imgname: The name of the image file, including the file extension.
Returns:
The URL of the image file.
"""
base_url = config["lfs-url"]
full_path = inspect.stack()[1].filename
filename = Path(full_path).stem
image_url = f"{base_url}/{filename}/{imgname}"
return image_url

0 comments on commit 0ebbd68

Please sign in to comment.