-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
63 lines (53 loc) · 1.9 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from setuptools import setup, find_packages
import os
import sys
import subprocess
import logging
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def check_hailo_package():
try:
import hailo
except ImportError:
logger.error("Hailo python package not found. Please make sure you're in the Hailo virtual environment. Run 'source setup_env.sh' and try again.")
sys.exit(1)
def read_requirements():
with open("requirements.txt", "r") as f:
return f.read().splitlines()
def run_shell_command(command, error_message):
logger.info(f"Running command: {command}")
result = subprocess.run(command, shell=True)
if result.returncode != 0:
logger.error(f"{error_message}. Exit code: {result.returncode}")
sys.exit(result.returncode)
def main():
check_hailo_package()
requirements = read_requirements()
logger.info("Compiling C++ code...")
run_shell_command("./compile_postprocess.sh", "Failed to compile C++ code")
logger.info("Downloading Resources...")
run_shell_command("./download_resources.sh", "Failed to download resources")
setup(
name='clip-app',
version='0.4',
author='Gilad Nahor',
author_email='giladn@hailo.ai',
description='Real time CLIP zero shot classification and detection',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
packages=find_packages(),
install_requires=requirements,
entry_points={
'console_scripts': [
'clip_app=clip_app.clip_app:main',
'text_image_matcher=clip_app.text_image_matcher:main',
],
},
package_data={
'clip_app': ['*.json', '*.sh', '*.cpp', '*.hpp', '*.pc'],
},
include_package_data=True,
)
if __name__ == '__main__':
main()