Skip to content

Commit

Permalink
demo + actions
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Oct 30, 2023
1 parent 553705c commit f440b74
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
- name: Pre-build dependencies
run: python -m pip install --upgrade pip

# ************** REMOVE AFTER RELEASE ********************
- name: Build binding
run: |
pip install wheel && cd ../../binding/python && python setup.py sdist bdist_wheel && pip install dist/pvoctopus-2.0.0-py3-none-any.whl
# ********************************************************

- name: Install dependencies
run: pip install -r requirements.txt

Expand Down
25 changes: 10 additions & 15 deletions demo/python/octopus_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,20 @@ def stop(self):
def main():
parser = argparse.ArgumentParser()

parser.add_argument('--audio_paths', nargs='+', help='Absolute paths to input audio files', required=True)

parser.add_argument('--library_path', help='Absolute path to dynamic library', default=pvoctopus.LIBRARY_PATH)

parser.add_argument(
'--model_path',
help='Absolute path to the file containing model parameters',
default=pvoctopus.MODEL_PATH)

parser.add_argument(
'--access_key',
help='AccessKey provided by Picovoice Console (https://console.picovoice.ai/)',
required=True)

parser.add_argument('--audio_paths', nargs='+', help='Absolute paths to input audio files', required=True)

parser.add_argument('--library_path', help='Absolute path to dynamic library')

parser.add_argument('--model_path', help='Absolute path to the file containing model parameters')

parser.add_argument(
'--search_phrase',
help='Phrase to search in the provided audio paths',
default=None
)
help='Phrase to search in the provided audio paths')

args = parser.parse_args()

Expand All @@ -77,7 +72,7 @@ def main():
library_path=args.library_path,
model_path=args.model_path)
print("Octopus version: %s" % octopus.version)
except (MemoryError, ValueError, RuntimeError, PermissionError) as e:
except pvoctopus.OctopusError as e:
print(e)
sys.exit(1)

Expand All @@ -88,7 +83,7 @@ def main():
try:
print("\rindexing '%s'" % os.path.basename(audio_file))
metadata_list.append(octopus.index_audio_file(os.path.abspath(audio_file)))
except (MemoryError, ValueError, RuntimeError, PermissionError, IOError) as e:
except pvoctopus.OctopusError as e:
print("Failed to process '%s' with '%s'" % (os.path.basename(audio_file), e))
octopus.delete()
sys.exit(1)
Expand All @@ -104,7 +99,7 @@ def main():
for i, metadata in enumerate(metadata_list):
try:
matches = octopus.search(metadata, [str(search_phrase)])
except pvoctopus.OctopusInvalidArgumentError as e:
except pvoctopus.OctopusError as e:
print(e)
continue
if len(matches) != 0:
Expand Down
2 changes: 1 addition & 1 deletion demo/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pvoctopus==1.2.0
pvoctopus==2.0.0
tabulate
4 changes: 2 additions & 2 deletions demo/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

setuptools.setup(
name="pvoctopusdemo",
version="1.2.1",
version="2.0.0",
author="Picovoice",
author_email="[email protected]",
description="Octopus Speech-to-Index engine demo.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Picovoice/octopus",
packages=["pvoctopusdemo"],
install_requires=["pvoctopus==1.2.1", "tabulate"],
install_requires=["pvoctopus==2.0.0", "tabulate"],
include_package_data=True,
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down

0 comments on commit f440b74

Please sign in to comment.