Skip to content

Commit

Permalink
Change how version is obtained
Browse files Browse the repository at this point in the history
Previous attempt did not work
  • Loading branch information
greenw0lf committed Sep 30, 2024
1 parent 5b832ea commit cdce764
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
16 changes: 11 additions & 5 deletions asr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import time
import pkg_resources
import tomli

from base_util import get_asset_info, asr_output_dir, save_provenance
from config import (
Expand All @@ -25,9 +25,15 @@

logger = logging.getLogger(__name__)
os.environ["HF_HOME"] = model_base_dir # change dir where model is downloaded
my_version = pkg_resources.get_distribution(
"whisper-asr-worker"
).version # get worker version


def _get_project_meta():
with open('pyproject.toml', mode='rb') as pyproject:
return tomli.load(pyproject)['tool']['poetry']


pkg_meta = _get_project_meta()
version = str(pkg_meta['version'])


def run(input_uri: str, output_uri: str, model=None) -> bool:
Expand Down Expand Up @@ -114,7 +120,7 @@ def run(input_uri: str, output_uri: str, model=None) -> bool:
"beam_size": w_beam_size,
"best_of": w_best_of,
},
"software_version": my_version,
"software_version": version,
"input_data": input_uri,
"output_data": output_uri if output_uri else output_path,
"steps": prov_steps,
Expand Down
33 changes: 22 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ validators = "^0.33.0"
boto3 = "^1.35.10"
fastapi = "^0.115.0"
uvicorn = "^0.30.6"
tomli = "^2.0.1"

[tool.poetry.group.dev.dependencies]
moto = "^5.0.13"
Expand Down
2 changes: 1 addition & 1 deletion transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def try_transcode(input_path, asset_id, extension) -> Optional[TranscodeOutput]:
provenance = {
"activity_name": "Transcoding",
"activity_description": "Checks if input needs transcoding, then transcodes if so",
"processing_time_ms": 0,
"processing_time_ms": -1,
"start_time_unix": start_time,
"parameters": [],
"software_version": "",
Expand Down

0 comments on commit cdce764

Please sign in to comment.